From 794a25ba1600eecaf862691f5981fab1d092cbfe Mon Sep 17 00:00:00 2001 From: Allink Date: Tue, 25 Jul 2023 16:40:25 +0100 Subject: [PATCH] Remove getCommandMap() method in CommandBlocker --- .../blocking/command/CommandBlocker.java | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java index e1da4f2d..7a91d0cb 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java @@ -30,24 +30,6 @@ public class CommandBlocker extends FreedomService private final Map entryList = Maps.newHashMap(); private final List unknownCommands = Lists.newArrayList(); - public static CommandMap getCommandMap() - { - try - { - SimplePluginManager simplePluginManager = (SimplePluginManager)Bukkit.getServer().getPluginManager(); - - Field commandMapField = SimplePluginManager.class.getDeclaredField("commandMap"); - commandMapField.setAccessible(true); - - return (SimpleCommandMap)commandMapField.get(simplePluginManager); - } - catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) - { - FLog.severe("Failed to get command map field (" + e.getMessage() + ")"); - } - return null; - } - @Override public void onStart() { @@ -65,7 +47,7 @@ public class CommandBlocker extends FreedomService entryList.clear(); unknownCommands.clear(); - final CommandMap commandMap = getCommandMap(); + final CommandMap commandMap = Bukkit.getCommandMap(); @SuppressWarnings("unchecked") List blockedCommands = (List)ConfigEntry.BLOCKED_COMMANDS.getList();