Archiviert
13
0

Don't tick chunks or entities on chunks that are queued for unload.

Treat chunks in the unload queue as if they are already unloaded to prevent
processing on them removing them from the unload queue and leaking.
Dieser Commit ist enthalten in:
Travis Watkins 2012-08-04 02:22:57 -05:00
Ursprung fdd01feb8c
Commit e5acb6cf3a
2 geänderte Dateien mit 30 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -23,7 +23,7 @@ public class ChunkProviderServer implements IChunkProvider {
public Chunk emptyChunk; public Chunk emptyChunk;
public IChunkProvider chunkProvider; // CraftBukkit public IChunkProvider chunkProvider; // CraftBukkit
private IChunkLoader e; private IChunkLoader e;
public boolean forceChunkLoad = false; // true -> false public boolean forceChunkLoad = true;
public LongHashtable<Chunk> chunks = new LongHashtable<Chunk>(); public LongHashtable<Chunk> chunks = new LongHashtable<Chunk>();
public List chunkList = new ArrayList(); public List chunkList = new ArrayList();
public WorldServer world; public WorldServer world;
@ -37,7 +37,7 @@ public class ChunkProviderServer implements IChunkProvider {
} }
public boolean isChunkLoaded(int i, int j) { public boolean isChunkLoaded(int i, int j) {
return this.chunks.containsKey(i, j); // CraftBukkit return !this.unloadQueue.containsKey(i, j) && this.chunks.containsKey(i, j); // CraftBukkit
} }
public void queueUnload(int i, int j) { public void queueUnload(int i, int j) {

Datei anzeigen

@ -1053,7 +1053,12 @@ public abstract class World implements IBlockAccess {
for (i = 0; i < this.j.size(); ++i) { for (i = 0; i < this.j.size(); ++i) {
entity = (Entity) this.j.get(i); entity = (Entity) this.j.get(i);
// CraftBukkit start - fixed an NPE // CraftBukkit start - fixed an NPE, don't process entities in chunks queued for unload
ChunkProviderServer chunkProviderServer = ((WorldServer) entity.world).chunkProviderServer;
if (chunkProviderServer.unloadQueue.containsKey(MathHelper.floor(entity.locX) >> 4, MathHelper.floor(entity.locZ) >> 4)) {
continue;
}
if (entity == null) { if (entity == null) {
continue; continue;
} }
@ -1092,6 +1097,14 @@ public abstract class World implements IBlockAccess {
for (i = 0; i < this.entityList.size(); ++i) { for (i = 0; i < this.entityList.size(); ++i) {
entity = (Entity) this.entityList.get(i); entity = (Entity) this.entityList.get(i);
// CraftBukkit start - don't tick entities in chunks queued for unload
ChunkProviderServer chunkProviderServer = ((WorldServer) entity.world).chunkProviderServer;
if (chunkProviderServer.unloadQueue.containsKey(MathHelper.floor(entity.locX) >> 4, MathHelper.floor(entity.locZ) >> 4)) {
continue;
}
// CraftBukkit end
if (entity.vehicle != null) { if (entity.vehicle != null) {
if (!entity.vehicle.dead && entity.vehicle.passenger == entity) { if (!entity.vehicle.dead && entity.vehicle.passenger == entity) {
continue; continue;
@ -1129,6 +1142,13 @@ public abstract class World implements IBlockAccess {
while (iterator.hasNext()) { while (iterator.hasNext()) {
TileEntity tileentity = (TileEntity) iterator.next(); TileEntity tileentity = (TileEntity) iterator.next();
// CraftBukkit start - don't tick entities in chunks queued for unload
ChunkProviderServer chunkProviderServer = ((WorldServer) tileentity.world).chunkProviderServer;
if (chunkProviderServer.unloadQueue.containsKey(tileentity.x >> 4, tileentity.z >> 4)) {
continue;
}
// CraftBukkit end
if (!tileentity.p() && tileentity.m() && this.isLoaded(tileentity.x, tileentity.y, tileentity.z)) { if (!tileentity.p() && tileentity.m() && this.isLoaded(tileentity.x, tileentity.y, tileentity.z)) {
tileentity.g(); tileentity.g();
} }
@ -1791,6 +1811,13 @@ public abstract class World implements IBlockAccess {
for (int l = -b0; l <= b0; ++l) { for (int l = -b0; l <= b0; ++l) {
for (int i1 = -b0; i1 <= b0; ++i1) { for (int i1 = -b0; i1 <= b0; ++i1) {
// CraftBukkit start - don't tick chunks queued for unload
ChunkProviderServer chunkProviderServer = ((WorldServer) entityhuman.world).chunkProviderServer;
if (chunkProviderServer.unloadQueue.containsKey(l + j, i1 + k)) {
continue;
}
// CraftBukkit end
this.chunkTickList.add(org.bukkit.craftbukkit.util.LongHash.toLong(l + j, i1 + k)); // CraftBukkit this.chunkTickList.add(org.bukkit.craftbukkit.util.LongHash.toLong(l + j, i1 + k)); // CraftBukkit
} }
} }