Remove chunks after calling ChunkUnloadEvent (Fixes #2919)

This commit is contained in:
Shane Freeder 2020-01-30 16:57:46 +00:00
parent 3740be5966
commit 0218e094e0

View File

@ -1700,7 +1700,7 @@ index c88a62f6b..5dbd3e60f 100644
this.d = i;
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 55373cae0..a263f60d4 100644
index 55373cae0..517014d21 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
@ -1786,13 +1786,13 @@ index 55373cae0..a263f60d4 100644
/*
* If it's a new world, the first few chunks are generated inside
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
}
public void unloadCallback() {
+ ((WorldServer)this.world).getChunkProvider().removeLoadedChunk(this); // Paper
org.bukkit.Server server = this.world.getServer();
org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(this.bukkitChunk, this.isNeedsSaving());
server.getPluginManager().callEvent(unloadEvent);
// note: saving can be prevented, but not forced if no saving is actually required
this.mustNotSave = !unloadEvent.isSaveChunk();
+ ((WorldServer)this.world).getChunkProvider().removeLoadedChunk(this); // Paper
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/ChunkCache.java b/src/main/java/net/minecraft/server/ChunkCache.java
index 11c4d23ba..53c15c1c0 100644
--- a/src/main/java/net/minecraft/server/ChunkCache.java