From 561f77a90437516402468cbe68619ed73c4a5656 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Tue, 23 Jul 2019 02:59:48 -0700 Subject: [PATCH] Ensure xray does not perform non MT-Safe operations (#2361) --- Spigot-Server-Patches/Anti-Xray.patch | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Spigot-Server-Patches/Anti-Xray.patch b/Spigot-Server-Patches/Anti-Xray.patch index 755b29973..08bfa30b9 100644 --- a/Spigot-Server-Patches/Anti-Xray.patch +++ b/Spigot-Server-Patches/Anti-Xray.patch @@ -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 new file mode 100644 -index 0000000000..9d8bee5cac +index 0000000000..23626bef3a --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java @@ -0,0 +0,0 @@ @@ -536,13 +536,18 @@ index 0000000000..9d8bee5cac + + } finally { + if (chunkPacketInfoAntiXray.ticketHold != null) { -+ MCUtil.ensureMain(null, (Runnable) () -> { ++ Runnable runnable = () -> { + Chunk chunk = chunkPacketInfoAntiXray.getChunk(); + ChunkCoordIntPair chunkPos = chunk.getPos(); + + ChunkPacketBlockControllerAntiXray.this.removeXrayTickets(chunkPos.x, chunkPos.z, (ChunkProviderServer) chunk.world.getChunkProvider(), + chunkPacketInfoAntiXray.ticketHold); -+ }); ++ }; ++ if (MinecraftServer.getServer().isMainThread()) { ++ runnable.run(); ++ } else { ++ MinecraftServer.getServer().scheduleOnMain(runnable); ++ } + } + } + }