Paper/patches/server/0874-Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch
Owen 89d51d5f29
Allow enabling sand duping (#10191)
Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable.

It should be noted that this decision does not promise all future exploits will be configurable.
2024-03-03 17:05:34 -05: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 10450a2bb6973a647fb6969d3c142e7a6a1011a4..56a6b3921c74bdeb27f8736302503bee1f731065 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -354,7 +354,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(this.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(this.getClass().getClassLoader().getResourceAsStream("configurations/commands.yml"), Charsets.UTF_8));
+ if (this.commandsConfiguration.contains("aliases")) commandsDefaults.set("aliases", null);
+ this.commandsConfiguration.setDefaults(commandsDefaults);
+ // Paper end - don't enforce icanhasbukkit default if alias block exists
this.saveCommandsConfig();
// Migrate aliases from old file and add previously implicit $1- to pass all arguments