From ea6bfa8387c7c25f2e1a132181663cbf7ea47237 Mon Sep 17 00:00:00 2001 From: JeromSar Date: Sun, 10 May 2015 23:28:13 +0200 Subject: [PATCH] Fix commandblocker not blocking properly. Resolves #586 --- buildnumber.properties | 4 ++-- .../TotalFreedomMod/Listener/TFM_PlayerListener.java | 2 -- .../StevenLawson/TotalFreedomMod/TFM_CommandBlocker.java | 7 ++++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/buildnumber.properties b/buildnumber.properties index 6760496..f7e4bf8 100644 --- a/buildnumber.properties +++ b/buildnumber.properties @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Sun May 10 23:13:43 CEST 2015 -build.number=995 +#Sun May 10 23:27:12 CEST 2015 +build.number=998 diff --git a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java b/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java index f075ec1..19b8c74 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java +++ b/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java @@ -709,8 +709,6 @@ public class TFM_PlayerListener implements Listener TFM_Log.info(String.format("[PREPROCESS_COMMAND] %s(%s): %s", player.getName(), ChatColor.stripColor(player.getDisplayName()), command), true); } - command = command.toLowerCase().trim(); - // Blocked commands if (TFM_CommandBlocker.isCommandBlocked(command, event.getPlayer(), true)) { diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_CommandBlocker.java b/src/me/StevenLawson/TotalFreedomMod/TFM_CommandBlocker.java index 060456e..07bb137 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_CommandBlocker.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_CommandBlocker.java @@ -112,17 +112,22 @@ public class TFM_CommandBlocker return false; } + command = command.toLowerCase().trim(); + if (command.split(" ")[0].contains(":")) { TFM_Util.playerMsg(sender, "Plugin-specific commands are disabled."); return true; } + if (command.startsWith("/")) { + command = command.substring(1); + } + final String[] commandParts = command.split(" "); String subCommand = null; if (commandParts.length > 1) { - command = commandParts[0].substring(1); subCommand = StringUtils.join(commandParts, " ", 1, commandParts.length).toLowerCase(); }