From e8100564ff2d4eaeb50535c1831ad8a0b6979a02 Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 18 Nov 2016 21:17:52 +0100 Subject: [PATCH] Fix and shorten command registration --- src/main/java/de/epiceric/shopchest/ShopCommand.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/epiceric/shopchest/ShopCommand.java b/src/main/java/de/epiceric/shopchest/ShopCommand.java index c25fc29..a0315b4 100644 --- a/src/main/java/de/epiceric/shopchest/ShopCommand.java +++ b/src/main/java/de/epiceric/shopchest/ShopCommand.java @@ -47,10 +47,8 @@ class ShopCommand extends BukkitCommand { static void registerCommand(Command command, ShopChest plugin) throws ReflectiveOperationException { plugin.debug("Registering command " + command.getName()); - Method commandMap = plugin.getServer().getClass().getMethod("getCommandMap"); - Object cmdmap = commandMap.invoke(plugin.getServer()); - Method register = cmdmap.getClass().getMethod("register", String.class, Command.class); - register.invoke(cmdmap, command.getName(), command); + Object commandMap = plugin.getServer().getClass().getMethod("getCommandMap").invoke(plugin.getServer()); + commandMap.getClass().getMethod("register", String.class, Command.class).invoke(commandMap, "shopchest", command); } @Override