2021-08-26 04:16:27 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
|
|
Date: Sun, 20 Jun 2021 00:08:13 -0700
|
|
|
|
Subject: [PATCH] Do not allow ticket level changes when updating chunk ticking
|
|
|
|
state
|
|
|
|
|
|
|
|
This WILL cause state corruption if it happens. So, don't
|
|
|
|
allow it.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
2021-11-25 06:13:29 +01:00
|
|
|
index be8e63fb3e5c65157ea4ed9c0e3910aaba8c3d45..7418245d5d08706ca2a1378e769abfb0de1076ed 100644
|
2021-08-26 04:16:27 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
2021-11-25 06:13:29 +01:00
|
|
|
@@ -385,7 +385,13 @@ public class ChunkHolder {
|
2021-08-26 04:16:27 +02:00
|
|
|
CompletableFuture<Void> completablefuture1 = new CompletableFuture();
|
|
|
|
|
|
|
|
completablefuture1.thenRunAsync(() -> {
|
|
|
|
+ // Paper start - do not allow ticket level changes
|
|
|
|
+ boolean unloadingBefore = this.chunkMap.unloadingPlayerChunk;
|
|
|
|
+ this.chunkMap.unloadingPlayerChunk = true;
|
|
|
|
+ try {
|
|
|
|
+ // Paper end - do not allow ticket level changes
|
|
|
|
playerchunkmap.onFullChunkStatusChange(this.pos, playerchunk_state);
|
|
|
|
+ } finally { this.chunkMap.unloadingPlayerChunk = unloadingBefore; } // Paper - do not allow ticket level changes
|
|
|
|
}, executor);
|
|
|
|
this.pendingFullStateConfirmation = completablefuture1;
|
|
|
|
completablefuture.thenAccept((either) -> {
|
2021-11-25 06:13:29 +01:00
|
|
|
@@ -397,7 +403,12 @@ public class ChunkHolder {
|
2021-08-26 04:16:27 +02:00
|
|
|
|
|
|
|
private void demoteFullChunk(ChunkMap playerchunkmap, ChunkHolder.FullChunkStatus playerchunk_state) {
|
|
|
|
this.pendingFullStateConfirmation.cancel(false);
|
|
|
|
+ // Paper start - do not allow ticket level changes
|
|
|
|
+ boolean unloadingBefore = this.chunkMap.unloadingPlayerChunk;
|
|
|
|
+ this.chunkMap.unloadingPlayerChunk = true;
|
|
|
|
+ try { // Paper end - do not allow ticket level changes
|
|
|
|
playerchunkmap.onFullChunkStatusChange(this.pos, playerchunk_state);
|
|
|
|
+ } finally { this.chunkMap.unloadingPlayerChunk = unloadingBefore; } // Paper - do not allow ticket level changes
|
|
|
|
}
|
|
|
|
|
|
|
|
protected long updateCount; // Paper - correctly handle recursion
|