improve command reloading
This commit is contained in:
parent
945c0c9666
commit
ac197a73a1
@ -18,18 +18,16 @@ public interface VillagerOptimizerCommand extends CommandExecutor {
|
||||
|
||||
HashSet<VillagerOptimizerCommand> commands = new HashSet<>();
|
||||
static void reloadCommands() {
|
||||
VillagerOptimizer plugin = VillagerOptimizer.getInstance();
|
||||
CommandMap commandMap = plugin.getServer().getCommandMap();
|
||||
commands.forEach(command -> plugin.getCommand(command.label()).unregister(commandMap));
|
||||
commands.clear();
|
||||
|
||||
commands.add(new VillagerOptimizerCmd());
|
||||
commands.add(new OptVillagersRadius());
|
||||
commands.add(new UnOptVillagersRadius());
|
||||
|
||||
VillagerOptimizer plugin = VillagerOptimizer.getInstance();
|
||||
CommandMap commandMap = plugin.getServer().getCommandMap();
|
||||
commands.forEach(command -> {
|
||||
plugin.getCommand(command.label()).unregister(commandMap);
|
||||
plugin.getCommand(command.label()).setExecutor(command);
|
||||
});
|
||||
commands.forEach(command -> plugin.getCommand(command.label()).setExecutor(command));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user