Prevent Blocks from getting lost when a chunk reloads

This commit is contained in:
Erik Broes
2011-02-20 17:09:02 +01:00
parent ca4076077e
commit 6e3ee31336
4 changed files with 21 additions and 2 deletions

View File

@@ -44,7 +44,10 @@ public class Chunk {
}
// CraftBukkit start
bukkitChunk = new org.bukkit.craftbukkit.CraftChunk( this );
bukkitChunk = ((WorldServer) world).getWorld().popPreservedChunk( i, j );
if (bukkitChunk == null) {
bukkitChunk = new org.bukkit.craftbukkit.CraftChunk( this );
}
}
public org.bukkit.Chunk bukkitChunk;

View File

@@ -209,6 +209,8 @@ public class ChunkProviderServer implements IChunkProvider
ChunkUnloadEvent cue = new ChunkUnloadEvent(Type.CHUNK_UNLOADED, chunk.bukkitChunk);
server.getPluginManager().callEvent(cue);
if (!cue.isCancelled()) {
g.getWorld().preserveChunk( (CraftChunk) chunk.bukkitChunk );
chunk.e();
this.b(chunk);
this.a(chunk);