PaperMC/patches/server/0743-Do-not-allow-ticket-level-changes-when-updating-chun.patch
Josh Roy bc0dd0df3d Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
716b4fce Revert SnakeYAML upgrade
ca6f8942 Update to Minecraft 1.18-rc3
57e7e952 #683: Add Player#showDemoScreen

CraftBukkit Changes:
c98abfb0 Update to Minecraft 1.18-rc3
9b258501 #960: Add Player#showDemoScreen
d9542247 Produce remapped jars after bootstrap jar
99f3ddde SPIGOT-6808: Fix RegionAccessor#getBiome

Spigot Changes:
b7a4222e Update to Minecraft 1.18-rc3
2021-11-30 19:26:33 +01:00

40 lines
2.2 KiB
Diff

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
index b6445778a023531774784f1a6e569849dda4c8ce..c70e1018c5e5b65911ee430be123e38f03666df2 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -418,7 +418,13 @@ public class ChunkHolder {
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) -> {
@@ -435,7 +441,12 @@ public class ChunkHolder {
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