Unregister commands when reloading commands.yml
This commit is contained in:
parent
02905a84f9
commit
fd990ce66d
1 changed files with 8 additions and 1 deletions
|
|
@ -88,7 +88,13 @@ public class RCraftServer {
|
|||
public static void reloadCommandsConfiguration() {
|
||||
SimpleCommandMap commandMap = getCommandMap();
|
||||
Map<String, Command> map = RCommandMap.getKnownCommands(commandMap);
|
||||
Bukkit.getCommandAliases().keySet().forEach(map::remove);
|
||||
|
||||
for (String alias : Bukkit.getCommandAliases().keySet()) {
|
||||
Command aliasCommand = map.remove(alias);
|
||||
if (aliasCommand == null) continue;
|
||||
|
||||
aliasCommand.unregister(commandMap);
|
||||
}
|
||||
|
||||
YamlConfiguration commands = YamlConfiguration.loadConfiguration(getCommandsConfigFile());
|
||||
reflection.set(Bukkit.getServer(), "commandsConfiguration", commands);
|
||||
|
|
@ -106,6 +112,7 @@ public class RCraftServer {
|
|||
);
|
||||
|
||||
commandMap.registerServerAliases();
|
||||
RCraftServer.syncCommands();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue