diff --git a/buildnumber.properties b/buildnumber.properties index 9404505..bdbbaff 100644 --- a/buildnumber.properties +++ b/buildnumber.properties @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Tue May 12 20:14:59 CEST 2015 -build.number=1022 +#Tue May 12 20:32:19 CEST 2015 +build.number=1027 diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_CommandBlocker.java b/src/me/StevenLawson/TotalFreedomMod/TFM_CommandBlocker.java index 80af37f..7bc60d2 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_CommandBlocker.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_CommandBlocker.java @@ -1,11 +1,8 @@ package me.StevenLawson.TotalFreedomMod; -import java.lang.reflect.Field; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import me.StevenLawson.TotalFreedomMod.Commands.TFM_CommandLoader; import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry; import org.apache.commons.lang3.StringUtils; @@ -13,7 +10,6 @@ import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandMap; import org.bukkit.command.CommandSender; -import org.bukkit.command.SimpleCommandMap; import org.bukkit.entity.Player; public class TFM_CommandBlocker @@ -94,35 +90,6 @@ public class TFM_CommandBlocker if (command != null) { - // Temporarily workaround: Remove blocked command from the CommandMap - // In Spigot 1.8.3, cancelling PlayerCommandPreprocessEvent will have no effect - // This results in TFM failing to block player commands: The player will get a message, - // but the command will still execute. Removing the command from the CommandMap is a - // temporary workaround untill the related Spigot issue has been fixed. - // https://hub.spigotmc.org/jira/browse/SPIGOT-879 - try - { - Field field = SimpleCommandMap.class.getDeclaredField("knownCommands"); - field.setAccessible(true); - Map knownCommands = (Map) field.get(commandMap); - - Iterator it = knownCommands.entrySet().iterator(); - while (it.hasNext()) - { - final Object e = it.next(); - if (command.equals(((Entry) e).getValue())) - { - it.remove(); - } - } - } - catch (Exception ex) - { - TFM_Log.severe("Could not nullify command: " + command.getName()); - TFM_Log.severe(ex); - } - // End Temporary workaround - for (String alias : command.getAliases()) { BLOCKED_COMMANDS.put(alias.toLowerCase(), blockedCommandEntry); @@ -165,7 +132,7 @@ public class TFM_CommandBlocker subCommand = StringUtils.join(commandParts, " ", 1, commandParts.length).toLowerCase(); } - final CommandBlockerEntry entry = BLOCKED_COMMANDS.get(command); + final CommandBlockerEntry entry = BLOCKED_COMMANDS.get(commandParts[0]); if (entry == null) {