mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-29 22:02:23 +00: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 {
|
static void registerCommand(Command command, ShopChest plugin) throws ReflectiveOperationException {
|
||||||
plugin.debug("Registering command " + command.getName());
|
plugin.debug("Registering command " + command.getName());
|
||||||
|
|
||||||
Method commandMap = plugin.getServer().getClass().getMethod("getCommandMap");
|
Object commandMap = plugin.getServer().getClass().getMethod("getCommandMap").invoke(plugin.getServer());
|
||||||
Object cmdmap = commandMap.invoke(plugin.getServer());
|
commandMap.getClass().getMethod("register", String.class, Command.class).invoke(commandMap, "shopchest", command);
|
||||||
Method register = cmdmap.getClass().getMethod("register", String.class, Command.class);
|
|
||||||
register.invoke(cmdmap, command.getName(), command);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user