2024-12-15 05:32:25 +01:00
|
|
|
--- a/net/minecraft/server/level/DistanceManager.java
|
|
|
|
+++ b/net/minecraft/server/level/DistanceManager.java
|
2025-04-12 17:26:44 +02:00
|
|
|
@@ -72,6 +_,12 @@
|
2024-12-15 05:32:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!this.chunksToUpdateFutures.isEmpty()) {
|
|
|
|
+ // CraftBukkit start - SPIGOT-7780: Call chunk unload events before updateHighestAllowedStatus
|
|
|
|
+ for (final ChunkHolder chunkHolder : this.chunksToUpdateFutures) {
|
|
|
|
+ chunkHolder.callEventIfUnloading(chunkMap);
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end - SPIGOT-7780: Call chunk unload events before updateHighestAllowedStatus
|
|
|
|
+
|
|
|
|
for (ChunkHolder chunkHolder : this.chunksToUpdateFutures) {
|
|
|
|
chunkHolder.updateHighestAllowedStatus(chunkMap);
|
|
|
|
}
|
2025-04-12 17:26:44 +02:00
|
|
|
@@ -121,8 +_,10 @@
|
2024-12-15 05:32:25 +01:00
|
|
|
ChunkPos chunkPos = sectionPos.chunk();
|
|
|
|
long packedChunkPos = chunkPos.toLong();
|
|
|
|
ObjectSet<ServerPlayer> set = this.playersPerChunk.get(packedChunkPos);
|
|
|
|
- set.remove(player);
|
|
|
|
- if (set.isEmpty()) {
|
2024-12-15 13:05:35 +01:00
|
|
|
+ // Paper start - some state corruption happens here, don't crash, clean up gracefully
|
2024-12-17 20:59:43 +01:00
|
|
|
+ if (set != null) set.remove(player);
|
2024-12-15 13:05:35 +01:00
|
|
|
+ if (set == null || set.isEmpty()) {
|
2024-12-17 20:59:43 +01:00
|
|
|
+ // Paper end - some state corruption happens here, don't crash, clean up gracefully
|
2024-12-15 05:32:25 +01:00
|
|
|
this.playersPerChunk.remove(packedChunkPos);
|
|
|
|
this.naturalSpawnChunkCounter.update(packedChunkPos, Integer.MAX_VALUE, false);
|
|
|
|
this.playerTicketManager.update(packedChunkPos, Integer.MAX_VALUE, false);
|