From 857ece0812aee220339c96946494e2bc666a30e2 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Tue, 1 Nov 2022 18:29:52 +0000 Subject: [PATCH] Fix setting difficulity inside of API (Fixes #8533) Vanilla moved some logic around setting the world difficulty which was not adopted for inside of upstream properly, this addresses another such case --- ...er-World-Difficulty-Remembering-Difficulty.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/patches/server/Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/patches/server/Fix-Per-World-Difficulty-Remembering-Difficulty.patch index 500b0dabef..2ee3001afb 100644 --- a/patches/server/Fix-Per-World-Difficulty-Remembering-Difficulty.patch +++ b/patches/server/Fix-Per-World-Difficulty-Remembering-Difficulty.patch @@ -116,3 +116,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 for (SpawnCategory spawnCategory : SpawnCategory.values()) { if (CraftSpawnCategory.isValidForLimits(spawnCategory)) { +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World { + + @Override + public void setDifficulty(Difficulty difficulty) { +- this.getHandle().serverLevelData.setDifficulty(net.minecraft.world.Difficulty.byId(difficulty.getValue())); ++ this.getHandle().getServer().setDifficulty(this.getHandle(), net.minecraft.world.Difficulty.byId(difficulty.getValue()), true); // Paper - don't skip other difficulty-changing logic + } + + @Override