@SuppressWarnings("unchecked") public static HashMap<String, Command> getKnownCommands(CommandMap commandMap) { Object knownCommands = TFM_Util.getField(commandMap, "knownCommands"); if (knownCommands != null) { if (knownCommands instanceof HashMap) { return (HashMap<String, Command>) knownCommands; } } return null; }
@SuppressWarnings("unchecked") public static CommandMap getCommandMap() { final Object commandMap = TFM_Util.getField(Bukkit.getServer().getPluginManager(), "commandMap"); if (commandMap != null) { if (commandMap instanceof CommandMap) { return (CommandMap) commandMap; } } return null; }