From 9b7dd3af75f0b2cc76dfd5a5d317874fa21b4856 Mon Sep 17 00:00:00 2001 From: Luck Date: Thu, 5 Mar 2020 23:13:19 +0000 Subject: Some minor cleanup --- .../src/main/java/me/lucko/spark/bukkit/CommandMapUtil.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'spark-bukkit/src/main') diff --git a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/CommandMapUtil.java b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/CommandMapUtil.java index 28b7475..058ef55 100644 --- a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/CommandMapUtil.java +++ b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/CommandMapUtil.java @@ -72,9 +72,9 @@ enum CommandMapUtil { } } + @SuppressWarnings("unchecked") private static Map getKnownCommandMap() { try { - //noinspection unchecked return (Map) KNOWN_COMMANDS_FIELD.get(getCommandMap()); } catch (Exception e) { throw new RuntimeException("Could not get known commands map", e); @@ -87,10 +87,8 @@ enum CommandMapUtil { * @param plugin the plugin instance * @param command the command instance * @param aliases the command aliases - * @param the command executor class type - * @return the command executor */ - public static T registerCommand(Plugin plugin, T command, String... aliases) { + public static void registerCommand(Plugin plugin, CommandExecutor command, String... aliases) { Preconditions.checkArgument(aliases.length != 0, "No aliases"); for (String alias : aliases) { try { @@ -112,17 +110,14 @@ enum CommandMapUtil { e.printStackTrace(); } } - return command; } /** * Unregisters a CommandExecutor with the server * * @param command the command instance - * @param the command executor class type - * @return the command executor */ - public static T unregisterCommand(T command) { + public static void unregisterCommand(CommandExecutor command) { CommandMap map = getCommandMap(); try { //noinspection unchecked @@ -142,8 +137,6 @@ enum CommandMapUtil { } catch (Exception e) { throw new RuntimeException("Could not unregister command", e); } - - return command; } } \ No newline at end of file -- cgit