diff options
author | Mike Primm <mike@primmhome.com> | 2012-08-12 18:40:49 -0500 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-08-19 08:36:47 -0400 |
commit | 5254993510a208c0f3cc34b329a9ac037bde7073 (patch) | |
tree | bf395d76713ccfdfba320b2402d7bb301c577ce9 /src/main/java/net/minecraft/server | |
parent | cacfc71b46d30dc35f30848a9ce9d0fcfaae7b01 (diff) | |
download | craftbukkit-5254993510a208c0f3cc34b329a9ac037bde7073.tar craftbukkit-5254993510a208c0f3cc34b329a9ac037bde7073.tar.gz craftbukkit-5254993510a208c0f3cc34b329a9ac037bde7073.tar.lz craftbukkit-5254993510a208c0f3cc34b329a9ac037bde7073.tar.xz craftbukkit-5254993510a208c0f3cc34b329a9ac037bde7073.zip |
Fix issues with chunk saving. Fixes BUKKIT-2158, BUKKIT-2018 and BUKKIT-2229
Diffstat (limited to 'src/main/java/net/minecraft/server')
-rw-r--r-- | src/main/java/net/minecraft/server/Chunk.java | 1 | ||||
-rw-r--r-- | src/main/java/net/minecraft/server/ChunkProviderServer.java | 22 | ||||
-rw-r--r-- | src/main/java/net/minecraft/server/PlayerManager.java | 9 |
3 files changed, 28 insertions, 4 deletions
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java index 192cd6f1..9fedd372 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -70,6 +70,7 @@ public class Chunk { } public org.bukkit.Chunk bukkitChunk; + public boolean mustSave; // CraftBukkit end public Chunk(World world, byte[] abyte, int i, int j) { diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java index 7b76b4cd..3242f440 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -37,7 +37,7 @@ public class ChunkProviderServer implements IChunkProvider { } public boolean isChunkLoaded(int i, int j) { - return !this.unloadQueue.containsKey(i, j) && this.chunks.containsKey(i, j); // CraftBukkit + return this.chunks.containsKey(i, j); // CraftBukkit } public void queueUnload(int i, int j) { @@ -47,11 +47,25 @@ public class ChunkProviderServer implements IChunkProvider { int l = j * 16 + 8 - chunkcoordinates.z; short short1 = 128; - if (k < -short1 || k > short1 || l < -short1 || l > short1 || !(this.world.keepSpawnInMemory)) { // CraftBukkit - added 'this.world.keepSpawnInMemory' - this.unloadQueue.add(i, j); // CraftBukkit + // CraftBukkit start + if (k < -short1 || k > short1 || l < -short1 || l > short1 || !(this.world.keepSpawnInMemory)) { // Added 'this.world.keepSpawnInMemory' + this.unloadQueue.add(i, j); + + Chunk c = this.chunks.get(i, j); + if (c != null) { + c.mustSave = true; + } } + // CraftBukkit end } else { - this.unloadQueue.add(i, j); // CraftBukkit + // CraftBukkit start + this.unloadQueue.add(i, j); + + Chunk c = this.chunks.get(i, j); + if (c != null) { + c.mustSave = true; + } + // CraftBukkit end } } diff --git a/src/main/java/net/minecraft/server/PlayerManager.java b/src/main/java/net/minecraft/server/PlayerManager.java index 5409ba77..c824e67c 100644 --- a/src/main/java/net/minecraft/server/PlayerManager.java +++ b/src/main/java/net/minecraft/server/PlayerManager.java @@ -69,6 +69,15 @@ public class PlayerManager { return playerinstance; } + // CraftBukkit start + public final boolean isChunkInUse(int x, int z) { + PlayerInstance pi = a(x, z, false); + if (pi != null) { + return (PlayerInstance.b(pi).size() > 0); + } + return false; + } + // CraftBukkit end public void flagDirty(int i, int j, int k) { int l = i >> 4; |