From 32e2a91f14e4cddb794e48fd5d1c5366327439e6 Mon Sep 17 00:00:00 2001 From: ryanhamshire Date: Sat, 30 May 2015 13:16:19 -0700 Subject: [PATCH] Access trust slash commands list update. Now supports slash commands with specific parameters, like "/warp create". --- src/me/ryanhamshire/GriefPrevention/GriefPrevention.java | 2 +- .../ryanhamshire/GriefPrevention/PlayerEventHandler.java | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java index 023287b..b23057e 100644 --- a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java +++ b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java @@ -826,7 +826,7 @@ public class GriefPrevention extends JavaPlugin String [] commands = accessTrustSlashCommands.split(";"); 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 diff --git a/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java b/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java index f58b667..1055aef 100644 --- a/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java +++ b/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java @@ -440,7 +440,8 @@ class PlayerEventHandler implements Listener @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) synchronized void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event) { - String [] args = event.getMessage().split(" "); + String message = event.getMessage(); + String [] args = message.split(" "); String command = args[0].toLowerCase(); @@ -538,9 +539,10 @@ class PlayerEventHandler implements Listener //if requires access trust, check for permission 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; break;