diff options
author | KHobbits <rob@khobbits.co.uk> | 2013-01-31 20:38:36 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2013-01-31 20:38:36 +0000 |
commit | fddbd7a52a828a3b34af185492bb4e70c3aabba3 (patch) | |
tree | 94c897a7caf403eb0ef313ab8efd6819675563c8 /EssentialsGroupManager/src/org/anjocaido/groupmanager | |
parent | 360e3e8801622cd1d80bae9a6bb766a9d18aaea4 (diff) | |
parent | df0ccb58329de6a65c786996fdd70ec173846eaf (diff) | |
download | Essentials-fddbd7a52a828a3b34af185492bb4e70c3aabba3.tar Essentials-fddbd7a52a828a3b34af185492bb4e70c3aabba3.tar.gz Essentials-fddbd7a52a828a3b34af185492bb4e70c3aabba3.tar.lz Essentials-fddbd7a52a828a3b34af185492bb4e70c3aabba3.tar.xz Essentials-fddbd7a52a828a3b34af185492bb4e70c3aabba3.zip |
Merge branch 'groupmanager' of github.com:essentials/Essentials into 2.9
Conflicts:
EssentialsGroupManager/src/Changelog.txt
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido/groupmanager')
5 files changed, 70 insertions, 13 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java index 4fcd0a554..e5a24258e 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java @@ -22,6 +22,7 @@ import org.yaml.snakeyaml.reader.UnicodeReader; */ public class GMConfiguration { + private boolean allowCommandBlocks = false; private boolean opOverride = true; private boolean toggleValidate = true; private Integer saveInterval = 10; @@ -40,6 +41,7 @@ public class GMConfiguration { /* * Set defaults */ + allowCommandBlocks = false; opOverride = true; toggleValidate = true; saveInterval = 10; @@ -83,6 +85,7 @@ public class GMConfiguration { try { Map<String, Object> config = getElement("config", getElement("settings", GMconfig)); + allowCommandBlocks = (Boolean) config.get("allow_commandblocks"); opOverride = (Boolean) config.get("opOverrides"); toggleValidate = (Boolean) config.get("validate_toggle"); @@ -142,6 +145,10 @@ public class GMConfiguration { return (Map<String, Object>) map.get(element); } + public boolean isAllowCommandBlocks() { + + return allowCommandBlocks; + } public boolean isOpOverride() { @@ -183,4 +190,4 @@ public class GMConfiguration { } -}
\ No newline at end of file +} diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index 474ceae84..4bac6d2ef 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -34,6 +34,7 @@ import org.anjocaido.groupmanager.utils.Tasks; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.OfflinePlayer; +import org.bukkit.block.Block; import org.bukkit.command.BlockCommandSender; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -387,10 +388,12 @@ public class GroupManager extends JavaPlugin { Group senderGroup = null; User senderUser = null; boolean isOpOverride = config.isOpOverride(); + boolean isAllowCommandBlocks = config.isAllowCommandBlocks(); // PREVENT GM COMMANDS BEING USED ON COMMANDBLOCKS - if (sender instanceof BlockCommandSender) { - sender.sendMessage(ChatColor.RED + "GM Commands can not be called from CommandBlocks"); + if (sender instanceof BlockCommandSender && !isAllowCommandBlocks) { + Block block = ((BlockCommandSender)sender).getBlock(); + GroupManager.logger.warning(ChatColor.RED + "GM Commands can not be called from the CommandBlock at location: " + ChatColor.GREEN + block.getWorld().getName() + " - " + block.getX() + ", " + block.getY() + ", " + block.getZ()); return true; } @@ -404,7 +407,7 @@ public class GroupManager extends JavaPlugin { senderPlayer = (Player) sender; if (!lastError.isEmpty() && !commandLabel.equalsIgnoreCase("manload")) { - sender.sendMessage(ChatColor.RED + "All commands are locked due to an error. " + ChatColor.BOLD + "" + ChatColor.UNDERLINE + "Check the log" + ChatColor.RESET + "" + ChatColor.RED + " and then try a '/manload'."); + GroupManager.logger.warning(ChatColor.RED + "All commands are locked due to an error. " + ChatColor.BOLD + "" + ChatColor.UNDERLINE + "Check the log" + ChatColor.RESET + "" + ChatColor.RED + " and then try a '/manload'."); return true; } @@ -1900,7 +1903,7 @@ public class GroupManager extends JavaPlugin { case manselect: if (args.length < 1) { - sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <world>)"); + sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manselect <world>)"); sender.sendMessage(ChatColor.YELLOW + "Worlds available: "); ArrayList<OverloadedWorldHolder> worlds = worldsHolder.allWorldsDataList(); auxString = ""; @@ -1940,6 +1943,42 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.YELLOW + "You have removed your world selection. Working with current world(if possible)."); return true; + + case mancheckw: + if (args.length < 1) { + sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mancheckw <world>)"); + sender.sendMessage(ChatColor.YELLOW + "Worlds available: "); + ArrayList<OverloadedWorldHolder> worlds = worldsHolder.allWorldsDataList(); + auxString = ""; + for (int i = 0; i < worlds.size(); i++) { + auxString += worlds.get(i).getName(); + if ((i + 1) < worlds.size()) { + auxString += ", "; + } + } + sender.sendMessage(ChatColor.YELLOW + auxString); + return false; + } + + auxString = ""; + for (int i = 0; i < args.length; i++) { + if (args[i] == null) { + logger.warning("Bukkit gave invalid arguments array! Cmd: " + cmd.getName() + " args.length: " + args.length); + return false; + } + auxString += args[i]; + if (i < (args.length - 1)) { + auxString += " "; + } + } + dataHolder = worldsHolder.getWorldData(auxString); + + sender.sendMessage(ChatColor.YELLOW + "You have selected world '" + dataHolder.getName() + "'."); + sender.sendMessage(ChatColor.YELLOW + "This world is using the following data files.."); + sender.sendMessage(ChatColor.YELLOW + "Groups: " + dataHolder.getGroupsFile().getAbsolutePath()); + sender.sendMessage(ChatColor.YELLOW + "Users: " + dataHolder.getUsersFile().getAbsolutePath()); + + return true; default: break; diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java index 12a6a5150..2661c6bc0 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java @@ -477,14 +477,22 @@ public class WorldsHolder { private void verifyFirstRun() { - Properties server = new Properties(); - try { - server.load(new FileInputStream(new File("server.properties"))); - serverDefaultWorldName = server.getProperty("level-name").toLowerCase(); - setupWorldFolder(serverDefaultWorldName); - } catch (IOException ex) { - GroupManager.logger.log(Level.SEVERE, null, ex); + /* Do not use the folder name if this + * is a Bukkit Forge server. + */ + if (plugin.getServer().getName().equalsIgnoreCase("BukkitForge")) { + serverDefaultWorldName = "overworld"; + + } else { + Properties server = new Properties(); + try { + server.load(new FileInputStream(new File("server.properties"))); + serverDefaultWorldName = server.getProperty("level-name").toLowerCase(); + } catch (IOException ex) { + GroupManager.logger.log(Level.SEVERE, null, ex); + } } + setupWorldFolder(serverDefaultWorldName); } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index 7396f3f70..a221c56a2 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -172,6 +172,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { permArray.addAll(GroupManager.BukkitPermissions.getAllRegisteredPermissions(includeChildren)); allPerms = true; perms.remove("*"); + // Remove the no offline perms node as this should not be given. + perms.remove("groupmanager.noofflineperms"); } for (String perm : perms) { diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java index 4a7298b9c..020e4c6f1 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java @@ -49,5 +49,6 @@ public enum GroupManagerPermissions { mantogglesave, manworld, manselect, - manclear + manclear, + mancheckw } |