mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 04:32:11 -07:00
Fix recursive chunk loading in chunk unload event
Since the chunk may not even be at a loaded ticket level, the getChunk call may invoke a sync load. To prevent this, we can retrieve the full loaded chunk first which is guaranteed to be non-null when unloading.
This commit is contained in:
@@ -29481,6 +29481,19 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/jav
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
@@ -0,0 +0,0 @@ public class CraftChunk implements Chunk {
|
||||
}
|
||||
|
||||
public ChunkAccess getHandle(ChunkStatus chunkStatus) {
|
||||
+ // Paper start - rewrite chunk system
|
||||
+ net.minecraft.world.level.chunk.LevelChunk full = this.worldServer.getChunkIfLoaded(this.x, this.z);
|
||||
+ if (full != null) {
|
||||
+ return full;
|
||||
+ }
|
||||
+ // Paper end - rewrite chunk system
|
||||
ChunkAccess chunkAccess = this.worldServer.getChunk(this.x, this.z, chunkStatus);
|
||||
|
||||
// SPIGOT-7332: Get unwrapped extension
|
||||
@@ -0,0 +0,0 @@ public class CraftChunk implements Chunk {
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user