From 96a0e87068a7c0a680d7b3577f1b7a8fec1204db Mon Sep 17 00:00:00 2001 From: Rigby Date: Thu, 11 Aug 2011 10:29:39 +0100 Subject: [PATCH] Fixed chunks being overwritten with empty chunks when the memory setting is immediately changed after a world loads. --- src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 8cf3dd1bec..ed09f0f33d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -800,7 +800,13 @@ public class CraftWorld implements World { if (keepLoaded) { loadChunk(chunkCoordX + x, chunkCoordZ + z); } else { - unloadChunk(chunkCoordX + x, chunkCoordZ + z); + if (isChunkLoaded(chunkCoordX + x, chunkCoordZ + z)) { + if (this.getHandle().getChunkAt(chunkCoordX + x, chunkCoordZ + z).isEmpty()) { + unloadChunk(chunkCoordX + x, chunkCoordZ + z, false); + } else { + unloadChunk(chunkCoordX + x, chunkCoordZ + z); + } + } } } }