summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager/src/org/anjocaido/groupmanager
diff options
context:
space:
mode:
authorElgarL <ElgarL@palmergames.com>2013-01-30 11:45:27 -0800
committerElgarL <ElgarL@palmergames.com>2013-01-30 11:45:27 -0800
commit8afcd41ab25c54446b782be08dd5e31379b83931 (patch)
treec6e3e0b7f94c38b6ecc3e9b0feefb569c70ab43d /EssentialsGroupManager/src/org/anjocaido/groupmanager
parent6ea956b11c54f7247e82a2dcb1385670c481e2cc (diff)
parentb8a71761ec9ddbd2c894508581ef78d46b1ba93b (diff)
downloadEssentials-8afcd41ab25c54446b782be08dd5e31379b83931.tar
Essentials-8afcd41ab25c54446b782be08dd5e31379b83931.tar.gz
Essentials-8afcd41ab25c54446b782be08dd5e31379b83931.tar.lz
Essentials-8afcd41ab25c54446b782be08dd5e31379b83931.tar.xz
Essentials-8afcd41ab25c54446b782be08dd5e31379b83931.zip
Merge pull request #288 from necrodoom/patch-29
config option to allow GM commands in commandblocks
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido/groupmanager')
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java9
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java8
2 files changed, 13 insertions, 4 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 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;
}