aboutsummaryrefslogtreecommitdiff
path: root/spark-bukkit/src/main
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2020-03-05 23:13:19 +0000
committerLuck <git@lucko.me>2020-03-05 23:13:19 +0000
commit9b7dd3af75f0b2cc76dfd5a5d317874fa21b4856 (patch)
tree98541a5b6894c6edadc1c0712911519b1607395f /spark-bukkit/src/main
parentc8ee229857ce8d624aac4a074469474db8f297d3 (diff)
downloadspark-9b7dd3af75f0b2cc76dfd5a5d317874fa21b4856.tar.gz
spark-9b7dd3af75f0b2cc76dfd5a5d317874fa21b4856.tar.bz2
spark-9b7dd3af75f0b2cc76dfd5a5d317874fa21b4856.zip
Some minor cleanup
Diffstat (limited to 'spark-bukkit/src/main')
-rw-r--r--spark-bukkit/src/main/java/me/lucko/spark/bukkit/CommandMapUtil.java13
1 files changed, 3 insertions, 10 deletions
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<String, Command> getKnownCommandMap() {
try {
- //noinspection unchecked
return (Map<String, Command>) 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 <T> the command executor class type
- * @return the command executor
*/
- public static <T extends CommandExecutor> 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 <T> the command executor class type
- * @return the command executor
*/
- public static <T extends CommandExecutor> 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