Fix issues with chunk saving. Fixes BUKKIT-2158, BUKKIT-2018 and BUKKIT-2229

This commit is contained in:
Mike Primm
2012-08-12 18:40:49 -05:00
committed by EvilSeph
parent cacfc71b46
commit 5254993510
4 changed files with 33 additions and 22 deletions

View File

@@ -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) {

View File

@@ -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
}
}

View File

@@ -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;