From 53ea88badf1573fc3a5f873878786effad96d8b8 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 28 Jun 2020 04:01:01 -0400 Subject: [PATCH] Fix Per World Difficulty / Remembering Difficulty Fixes per world difficulty with /difficulty command and also makes it so that the server keeps the last difficulty used instead of restoring the server.properties every single load. --- ...ld-Difficulty-Remembering-Difficulty.patch | 77 +++++++++++++++++++ .../Improved-Watchdog-Support.patch | 1 + 2 files changed, 78 insertions(+) create mode 100644 Spigot-Server-Patches/Fix-Per-World-Difficulty-Remembering-Difficulty.patch diff --git a/Spigot-Server-Patches/Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/Spigot-Server-Patches/Fix-Per-World-Difficulty-Remembering-Difficulty.patch new file mode 100644 index 0000000000..de1a6466b3 --- /dev/null +++ b/Spigot-Server-Patches/Fix-Per-World-Difficulty-Remembering-Difficulty.patch @@ -0,0 +1,77 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 28 Jun 2020 03:59:10 -0400 +Subject: [PATCH] Fix Per World Difficulty / Remembering Difficulty + +Fixes per world difficulty with /difficulty command and also +makes it so that the server keeps the last difficulty used instead +of restoring the server.properties every single load. + +diff --git a/src/main/java/net/minecraft/server/CommandDifficulty.java b/src/main/java/net/minecraft/server/CommandDifficulty.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/CommandDifficulty.java ++++ b/src/main/java/net/minecraft/server/CommandDifficulty.java +@@ -0,0 +0,0 @@ public class CommandDifficulty { + public static int a(CommandListenerWrapper commandlistenerwrapper, EnumDifficulty enumdifficulty) throws CommandSyntaxException { + MinecraftServer minecraftserver = commandlistenerwrapper.getServer(); + +- if (minecraftserver.getSaveData().getDifficulty() == enumdifficulty) { ++ WorldServer world = commandlistenerwrapper.getWorld(); // Paper ++ if (world.worldDataServer.getDifficulty() == enumdifficulty) { // Paper + throw CommandDifficulty.a.create(enumdifficulty.c()); + } else { +- minecraftserver.a(enumdifficulty, true); ++ minecraftserver.a(world, enumdifficulty, true); // Paper + commandlistenerwrapper.sendMessage(new ChatMessage("commands.difficulty.success", new Object[]{enumdifficulty.b()}), true); + return 0; + } +diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/DedicatedServer.java +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + + @Override + public void updateWorldSettings() { +- this.a(this.getDedicatedServerProperties().difficulty, true); ++ //this.a(this.getDedicatedServerProperties().difficulty, true); // Paper - Don't overwrite level.dat's difficulty, keep current + } + + @Override +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant