Access trust slash commands list update.

Now supports slash commands with specific parameters, like "/warp
create".
This commit is contained in:
ryanhamshire committed 2015-05-30 13:16:19 -07:00
1 parent d1c621f713
commit 32e2a91f14
2 files changed
+6 -4

No files matched your search

@@ -826,7 +826,7 @@ public class GriefPrevention extends JavaPlugin
String [] commands = accessTrustSlashCommands.split(";"); String [] commands = accessTrustSlashCommands.split(";");
for(int i = 0; i < commands.length; i++) for(int i = 0; i < commands.length; i++)
{ {
this.config_claims_commandsRequiringAccessTrust.add(commands[i].trim()); this.config_claims_commandsRequiringAccessTrust.add(commands[i].trim().toLowerCase());
} }
//try to parse the list of commands which should be monitored for spam //try to parse the list of commands which should be monitored for spam
@@ -440,7 +440,8 @@ class PlayerEventHandler implements Listener
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
synchronized void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event) synchronized void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event)
{ {
String [] args = event.getMessage().split(" "); String message = event.getMessage();
String [] args = message.split(" ");
String command = args[0].toLowerCase(); String command = args[0].toLowerCase();
@@ -538,9 +539,10 @@ class PlayerEventHandler implements Listener
//if requires access trust, check for permission //if requires access trust, check for permission
isMonitoredCommand = false; isMonitoredCommand = false;
for(String monitoredCommand : GriefPrevention.instance.config_claims_commandsRequiringAccessTrust) String lowerCaseMessage = message.toLowerCase();
for(String monitoredCommand : GriefPrevention.instance.config_claims_commandsRequiringAccessTrust)
{ {
if(args[0].equalsIgnoreCase(monitoredCommand)) if(lowerCaseMessage.startsWith(monitoredCommand))
{ {
isMonitoredCommand = true; isMonitoredCommand = true;
break; break;