From b21010e7e39958c2fda4d5e4e0dc5d9ee6e9bdda Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Thu, 30 Jan 2020 16:57:46 +0000 Subject: [PATCH] Remove chunks after calling ChunkUnloadEvent (Fixes #2919) --- Spigot-Server-Patches/0004-MC-Utils.patch | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Spigot-Server-Patches/0004-MC-Utils.patch b/Spigot-Server-Patches/0004-MC-Utils.patch index c245bcda4b..dde8fa4064 100644 --- a/Spigot-Server-Patches/0004-MC-Utils.patch +++ b/Spigot-Server-Patches/0004-MC-Utils.patch @@ -1,4 +1,4 @@ -From cd1f391366035ee68c3eb7e2a1aa5ba19c2d7da2 Mon Sep 17 00:00:00 2001 +From 9360a474d1de17fd98648746c9ec18708a1711ad Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 28 Mar 2016 20:55:47 -0400 Subject: [PATCH] MC Utils @@ -1700,7 +1700,7 @@ index c88a62f6b..5dbd3e60f 100644 this.d = i; } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 55373cae0..a263f60d4 100644 +index 55373cae0..517014d21 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -25,7 +25,7 @@ import org.apache.logging.log4j.Logger; @@ -1785,14 +1785,14 @@ index 55373cae0..a263f60d4 100644 if (server != null) { /* * If it's a new world, the first few chunks are generated inside -@@ -540,6 +560,7 @@ public class Chunk implements IChunkAccess { - } - - public void unloadCallback() { -+ ((WorldServer)this.world).getChunkProvider().removeLoadedChunk(this); // Paper - org.bukkit.Server server = this.world.getServer(); - org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(this.bukkitChunk, this.isNeedsSaving()); +@@ -545,6 +565,7 @@ public class Chunk implements IChunkAccess { server.getPluginManager().callEvent(unloadEvent); + // note: saving can be prevented, but not forced if no saving is actually required + this.mustNotSave = !unloadEvent.isSaveChunk(); ++ ((WorldServer)this.world).getChunkProvider().removeLoadedChunk(this); // Paper + } + // CraftBukkit end + diff --git a/src/main/java/net/minecraft/server/ChunkCache.java b/src/main/java/net/minecraft/server/ChunkCache.java index 11c4d23ba..53c15c1c0 100644 --- a/src/main/java/net/minecraft/server/ChunkCache.java @@ -3281,5 +3281,5 @@ index 1aec70a1f..f72c13bed 100644 private int initialCapacity; -- -2.25.0.windows.1 +2.25.0