Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chunks don't unload when auto saving is disabled #181

Open
jtJava opened this issue Feb 10, 2024 · 0 comments
Open

Chunks don't unload when auto saving is disabled #181

jtJava opened this issue Feb 10, 2024 · 0 comments
Labels
bug Something isn't working confirmed

Comments

@jtJava
Copy link

jtJava commented Feb 10, 2024

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();
}

`

@uRyanxD uRyanxD added bug Something isn't working confirmed labels Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed
Projects
None yet
Development

No branches or pull requests

2 participants