mirror of
https://github.com/Flowsqy/ShopChest.git
synced 2024-11-14 23:15:10 +01:00
Fix and shorten command registration
This commit is contained in:
parent
fdfc7419d9
commit
e8100564ff
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user