mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Allow Reloading of Command Aliases
Reload the aliases stored in commands.yml
This commit is contained in:
parent
3e9512a6fc
commit
76de1e898e
@ -2844,5 +2844,24 @@ public final class CraftServer implements Server {
|
||||
DefaultPermissions.registerCorePermissions();
|
||||
CraftDefaultPermissions.registerCorePermissions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reloadCommandAliases() {
|
||||
Set<String> removals = getCommandAliases().keySet().stream()
|
||||
.map(key -> key.toLowerCase(java.util.Locale.ENGLISH))
|
||||
.collect(java.util.stream.Collectors.toSet());
|
||||
getCommandMap().getKnownCommands().keySet().removeIf(removals::contains);
|
||||
File file = getCommandsConfigFile();
|
||||
try {
|
||||
commandsConfiguration.load(file);
|
||||
} catch (FileNotFoundException ex) {
|
||||
return false;
|
||||
} catch (IOException | org.bukkit.configuration.InvalidConfigurationException ex) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file, ex);
|
||||
return false;
|
||||
}
|
||||
commandMap.registerServerAliases();
|
||||
return true;
|
||||
}
|
||||
// Paper end
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user