Ensure xray does not perform non MT-Safe operations (#2361)

This commit is contained in:
Spottedleaf
2019-07-23 02:59:48 -07:00
parent 61b8600730
commit 561f77a904

View File

@@ -133,7 +133,7 @@ index 0000000000..f7e376ce6a
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
new file mode 100644 new file mode 100644
index 0000000000..9d8bee5cac index 0000000000..23626bef3a
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
@@ -536,13 +536,18 @@ index 0000000000..9d8bee5cac
+ +
+ } finally { + } finally {
+ if (chunkPacketInfoAntiXray.ticketHold != null) { + if (chunkPacketInfoAntiXray.ticketHold != null) {
+ MCUtil.ensureMain(null, (Runnable) () -> { + Runnable runnable = () -> {
+ Chunk chunk = chunkPacketInfoAntiXray.getChunk(); + Chunk chunk = chunkPacketInfoAntiXray.getChunk();
+ ChunkCoordIntPair chunkPos = chunk.getPos(); + ChunkCoordIntPair chunkPos = chunk.getPos();
+ +
+ ChunkPacketBlockControllerAntiXray.this.removeXrayTickets(chunkPos.x, chunkPos.z, (ChunkProviderServer) chunk.world.getChunkProvider(), + ChunkPacketBlockControllerAntiXray.this.removeXrayTickets(chunkPos.x, chunkPos.z, (ChunkProviderServer) chunk.world.getChunkProvider(),
+ chunkPacketInfoAntiXray.ticketHold); + chunkPacketInfoAntiXray.ticketHold);
+ }); + };
+ if (MinecraftServer.getServer().isMainThread()) {
+ runnable.run();
+ } else {
+ MinecraftServer.getServer().scheduleOnMain(runnable);
+ }
+ } + }
+ } + }
+ } + }