Paper/patches/server/0970-Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch
BlockyTheDev 6dc8e30c92
Fix startup and runtime crashes (experimental branch) (#9606)
* Fix startup error

* Fix runtime error

- The code with '.getKey().getKey().getKey()' looks a bit strange but is necessary so the results on the timings website are the same as before. It gets the key (String) from the NamespacedKey, of the key from the Keyed, from the key of the Map.Entry.

* [ci skip] Add myself to LICENSE.md

* Remove wildcard import

* Revert import order
2023-08-15 09:41:56 -07:00

24 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: TheMeinerLP <p.glanz@madfix.me>
Date: Tue, 13 Jun 2023 16:10:59 +0200
Subject: [PATCH] Don't enforce icanhasbukkit default if alias block exists
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 41e5204b13c0a5455c3e79ca36cfe2790f542a48..9179459da2da38d3e211030d10d1375c47c5e72b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -345,7 +345,11 @@ public final class CraftServer implements Server {
}
this.commandsConfiguration = YamlConfiguration.loadConfiguration(this.getCommandsConfigFile());
this.commandsConfiguration.options().copyDefaults(true);
- this.commandsConfiguration.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("configurations/commands.yml"), Charsets.UTF_8)));
+ // Paper start - don't enforce icanhasbukkit default if alias block exists
+ final YamlConfiguration commandsDefaults = YamlConfiguration.loadConfiguration(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("configurations/commands.yml"), Charsets.UTF_8));
+ if (this.commandsConfiguration.contains("aliases")) commandsDefaults.set("aliases", null);
+ this.commandsConfiguration.setDefaults(commandsDefaults);
+ // Paper stop - dont enforce icanhasbukkit default if alias block exists
this.saveCommandsConfig();
// Migrate aliases from old file and add previously implicit $1- to pass all arguments