From dba25d1e86dfd546a6b4b06da7c8066d638915c1 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 12 May 2016 02:07:39 -0400 Subject: [PATCH] unmark chunk as unloading when unload is cancelled no obviousy bugs caused by this at the moment, but we may need to clean up process to be like how I use to have it before vanilla did it, and we shouldn't leave this boolean in an invalid state. --- ...s-unloading-when-unload-is-cancelled.patch | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Spigot-Server-Patches/0153-Unmark-chunk-as-unloading-when-unload-is-cancelled.patch diff --git a/Spigot-Server-Patches/0153-Unmark-chunk-as-unloading-when-unload-is-cancelled.patch b/Spigot-Server-Patches/0153-Unmark-chunk-as-unloading-when-unload-is-cancelled.patch new file mode 100644 index 0000000000..ad62ad4ec0 --- /dev/null +++ b/Spigot-Server-Patches/0153-Unmark-chunk-as-unloading-when-unload-is-cancelled.patch @@ -0,0 +1,34 @@ +From d2cbd64700e4bd54a1aec471f69977b63c6ea2ec Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 12 May 2016 02:03:56 -0400 +Subject: [PATCH] Unmark chunk as unloading when unload is cancelled + + +diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +index 4953e97..1981ae4 100644 +--- a/src/main/java/net/minecraft/server/Chunk.java ++++ b/src/main/java/net/minecraft/server/Chunk.java +@@ -46,7 +46,7 @@ public class Chunk { + private long w; + private int x; + private ConcurrentLinkedQueue y; +- public boolean d; ++ public boolean d;public void setShouldUnload(boolean unload) { this.d = unload; } // Paper // OBFHELPER + protected gnu.trove.map.hash.TObjectIntHashMap entityCount = new gnu.trove.map.hash.TObjectIntHashMap(); // Spigot + public int lightUpdates; // Paper - Number of queued light updates for this chunk + +diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +index 694f3d5..f67dbae 100644 +--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +@@ -309,6 +309,7 @@ public class ChunkProviderServer implements IChunkProvider { + Chunk chunk = (Chunk) this.chunks.get(olong); + + if (chunk != null && chunk.d) { ++ chunk.setShouldUnload(false); // Paper + if (chunk.hasLightUpdates()) continue; // Paper - Don't unload chunks with pending light updates. + // CraftBukkit start + ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk); +-- +2.8.2 +