Paper/patches/server/0108-Allow-Reloading-of-Command-Aliases.patch
Nassim Jahnke 1cfd363d32
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
fc460d1b PR-735: Add Villager#zombify
c8c8331e PR-690: Add method to read ItemStack input
62845f2f SPIGOT-6829: Add per-player world border API

CraftBukkit Changes:
a459f4d4 PR-1033: Add Villager#zombify
d65d1430 PR-975: Add method to read ItemStack input
b5559f8c SPIGOT-6990: Fix setRepairCost(0) in Anvil
6c308e1b SPIGOT-6829: Add per-player world border API

Spigot Changes:
42b61526 SPIGOT-7000: Generation and /locate issues when using custom structure seeds
2022-04-16 10:29:50 +02:00

37 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 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 265fbc13c571bcfb7d921445a75add522ec9de52..a93cf50004a68b0648f96d2f0ff2f9e4fd65ffc4 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2541,5 +2541,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
}