Paper/Spigot-Server-Patches/0128-Allow-Reloading-of-Command-Aliases.patch
Zach Brown dafc3dbcd5
Update upstream B/CB/S
--- work/Bukkit
Submodule work/Bukkit aba2aaaf..949124e0:
  > SPIGOT-5121: Method to set PierceLevel of arrows

--- work/CraftBukkit
Submodule work/CraftBukkit c6997924..bf329334:
  > SPIGOT-5133: Throwing items into secondary end world portal causes crash
  > SPIGOT-5121: Method to set PierceLevel of arrows
  > SPIGOT-5122: Skip world#notify if sign has no world.
  > SPIGOT-5105: The EntityTag nbt tag disappears from preset armor_stand items.
  > SPIGOT-5106: Config option to prevent plugins with incompatible API's from loading

--- work/Spigot
Submodule work/Spigot 595711b0..935adb34:
  > SPIGOT-5088: Additional growth modifiers
2019-07-01 23:51:06 -05:00

40 lines
1.5 KiB
Diff

From 89adafea0a7dbd4857a820c53f54efcea74a2ede Mon Sep 17 00:00:00 2001
From: willies952002 <admin@domnian.com>
Date: Mon, 28 Nov 2016 10:21:52 -0500
Subject: [PATCH] Allow Reloading of Command Aliases
Reload the aliases stored in commands.yml
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 5fbfda21e..bf7b5a6fb 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2074,5 +2074,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
}
--
2.22.0