PandaSpigot
PandaSpigot copied to clipboard
Chunks don't unload when auto saving is disabled
The following code in ChunkProviderServer prevents chunks from unloading if auto saving is disabled. I'd recommend hooking the config for disabling chunk saving into this, or just removing the check altogether. ` public boolean unloadChunks() { if (!this.world.savingDisabled) { if (HydrogenConfig.unloadChunks) { // CraftBukkit start Server server = this.world.getServer(); for (int i = 0; i < 100 && !this.unloadQueue.isEmpty(); ++i) { long chunkcoordinates = this.unloadQueue.popFirst(); Chunk chunk = this.chunks.get(chunkcoordinates); if (chunk == null) continue;
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
if (chunk != null) {
chunk.removeEntities();
this.saveChunk(chunk);
this.saveChunkNOP(chunk);
this.chunks.remove(chunkcoordinates); // CraftBukkit
}
// this.unloadQueue.remove(olong);
// Update neighbor counts
for (int x = -2; x < 3; x++) {
for (int z = -2; z < 3; z++) {
if (x == 0 && z == 0) {
continue;
}
Chunk neighbor = this.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
if (neighbor != null) {
neighbor.setNeighborUnloaded(-x, -z);
chunk.setNeighborUnloaded(x, z);
}
}
}
}
}
}
// Hydrogen end
// CraftBukkit end
if (this.chunkLoader != null) {
this.chunkLoader.a();
}
return this.chunkProvider.unloadChunks();
}
`