diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index dae50fd15..f3bc35baa 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -34,10 +34,10 @@ v 1.3: (for all worlds named in config.yml) - Attempt to stop GM wiping groups/users yml's on a bad shut down. - Added event handling to manage new world creation at runtime. - - Added the ability to handle unknown worlds at server start. - (GM will create the data files for any worlds it finds which are not in the config.yml) + - Added the ability to handle unknown worlds at server start. + (GM will create the data files for any worlds it finds which are not in the config.yml) - Fix for Bukkit passing a null To location on a player Portaling - - Fixed manudelsub not correctly selecting the group to remove. + - Fixed manudelsub not correctly selecting the group to remove. - Added two new permission nodes - groupmanager.notify.self & groupmanager.notify.other These allow players/admins to be notified when players are moved between groups. v 1.4: @@ -211,4 +211,5 @@ v 2.0: - Negate 'groupmanager.noofflineperms' by default in the owner group. - Add support for BukkitForge using 'overworld' as the main world name. - Prevent '*' permissions granting the 'groupmanager.noofflineperms' permission. - - Added '/mancheckw ' to inspect which permission files a world is referencing. \ No newline at end of file + - Added '/mancheckw ' to inspect which permission files a world is referencing. + - Add config potion to set if GM commands should be allowed on CommnandBlocks. diff --git a/EssentialsGroupManager/src/config.yml b/EssentialsGroupManager/src/config.yml index cc90bea6f..479399bb6 100644 --- a/EssentialsGroupManager/src/config.yml +++ b/EssentialsGroupManager/src/config.yml @@ -7,6 +7,10 @@ settings: # Default setting for 'mantoglevalidate' # true will cause GroupManager to attempt name matching by default. validate_toggle: true + # ********************************************************************************************************************************** + # *** NOTE: Having this feature enabled, improper use of commandblocks will lead to undesireable permission changes, be alarmed! *** + # ********************************************************************************************************************************** + allow_commandblocks: false data: save: @@ -39,4 +43,4 @@ settings: # world4: # - groups (World4 would use the groups.yml from world2, but it's own users.yml) # world5: - # - world6 (this would cause world6 to mirror both files from world5) \ No newline at end of file + # - world6 (this would cause world6 to mirror both files from world5) 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 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) 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 050bd9995..4a9b65317 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -387,10 +387,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(); + console.sendMessage(ChatColor.RED + "GM Commands can not be called from CommandBlock at location:" + ChatColor.GREEN + " " + block.getX + ", " + block.getY + ", " + block.getZ); return true; } @@ -399,7 +401,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; }