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

This commit is contained in:
Spottedleaf 2019-07-23 02:59:48 -07:00 committed by Shane Freeder
parent 160d1bc9e4
commit 396d3f13c4
1 changed files with 10 additions and 5 deletions

View File

@ -1,4 +1,4 @@
From 4512db9ba3624a674524887f0bb45e752c8548cc Mon Sep 17 00:00:00 2001
From 48964ee44dba83311bac3ea611cb999c4e3baa30 Mon Sep 17 00:00:00 2001
From: stonar96 <minecraft.stonar96@gmail.com>
Date: Mon, 20 Aug 2018 03:03:58 +0200
Subject: [PATCH] Anti-Xray
@ -133,10 +133,10 @@ 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 +1,777 @@
@@ -0,0 +1,782 @@
+package com.destroystokyo.paper.antixray;
+
+import java.util.ArrayList;
@ -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);
+ }
+ }
+ }
+ }