diff --git a/patches/api/0011-Implement-ChunkTooLargeEvent.patch b/patches/api/0011-Implement-ChunkTooLargeEvent.patch index cf515cdd3..7f9e282cc 100644 --- a/patches/api/0011-Implement-ChunkTooLargeEvent.patch +++ b/patches/api/0011-Implement-ChunkTooLargeEvent.patch @@ -1,19 +1,19 @@ -From ce6fc9af1404461cd623734326aa93ad7789e163 Mon Sep 17 00:00:00 2001 +From 908db90639dd171e257f91d6e339608f1be3414d Mon Sep 17 00:00:00 2001 From: William Blake Galbreath Date: Fri, 12 Jul 2019 02:09:58 -0500 Subject: [PATCH] Implement ChunkTooLargeEvent --- - .../pl3x/purpur/event/ChunkTooLargeEvent.java | 108 ++++++++++++++++++ - 1 file changed, 108 insertions(+) + .../pl3x/purpur/event/ChunkTooLargeEvent.java | 109 ++++++++++++++++++ + 1 file changed, 109 insertions(+) create mode 100644 src/main/java/net/pl3x/purpur/event/ChunkTooLargeEvent.java diff --git a/src/main/java/net/pl3x/purpur/event/ChunkTooLargeEvent.java b/src/main/java/net/pl3x/purpur/event/ChunkTooLargeEvent.java new file mode 100644 -index 000000000..271d5b9d1 +index 00000000..f9d4a42c --- /dev/null +++ b/src/main/java/net/pl3x/purpur/event/ChunkTooLargeEvent.java -@@ -0,0 +1,108 @@ +@@ -0,0 +1,109 @@ +package net.pl3x.purpur.event; + +import org.bukkit.Bukkit; @@ -37,6 +37,7 @@ index 000000000..271d5b9d1 + private final boolean overzealous; + + public ChunkTooLargeEvent(@NotNull String worldName, int chunkX, int chunkZ, boolean saving, boolean overzealous) { ++ super(!Bukkit.isPrimaryThread()); + this.worldName = worldName; + this.world = Bukkit.getWorld(worldName); + this.chunkX = chunkX; @@ -123,5 +124,5 @@ index 000000000..271d5b9d1 + } +} -- -2.20.1 +2.23.0.rc1 diff --git a/patches/server/0039-Implement-ChunkTooLargeEvent.patch b/patches/server/0039-Implement-ChunkTooLargeEvent.patch index f1f5ed728..dc2498a7c 100644 --- a/patches/server/0039-Implement-ChunkTooLargeEvent.patch +++ b/patches/server/0039-Implement-ChunkTooLargeEvent.patch @@ -1,4 +1,4 @@ -From 9a051a6cf53eef4ebf1163c58067f6bdf49f8722 Mon Sep 17 00:00:00 2001 +From 43def9bbbf0a34ae04d5aafc30d8905913ce33af Mon Sep 17 00:00:00 2001 From: William Blake Galbreath Date: Fri, 12 Jul 2019 02:10:06 -0500 Subject: [PATCH] Implement ChunkTooLargeEvent @@ -8,7 +8,7 @@ Subject: [PATCH] Implement ChunkTooLargeEvent 1 file changed, 6 insertions(+) diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index d2b328945..103c0d1db 100644 +index d3d610742..d9283b36b 100644 --- a/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java @@ -21,6 +21,7 @@ public abstract class RegionFileCache implements AutoCloseable { @@ -39,7 +39,7 @@ index d2b328945..103c0d1db 100644 regionfile.setStatus(chunk.x, chunk.z, ChunkRegionLoader.getStatus(nbttagcompound)); // Paper - cache status on disk regionfile.setOversized(chunkX, chunkZ, false); } catch (RegionFile.ChunkTooLargeException ignored) { -+ MinecraftServer.getServer().scheduleOnMain(() -> new net.pl3x.purpur.event.ChunkTooLargeEvent(worldName, chunkX, chunkZ, true, false).callEvent()); // Purpur ++ new net.pl3x.purpur.event.ChunkTooLargeEvent(worldName, chunkX, chunkZ, true, false).callEvent(); // Purpur printOversizedLog("ChunkTooLarge! Someone is trying to duplicate.", regionfile.file, chunkX, chunkZ); // Clone as we are now modifying it, don't want to corrupt the pending save state nbttagcompound = nbttagcompound.clone(); @@ -47,7 +47,7 @@ index d2b328945..103c0d1db 100644 } regionfile.setStatus(chunk.x, chunk.z, ChunkRegionLoader.getStatus(nbttagcompound)); // Paper - cache status on disk } catch (RegionFile.ChunkTooLargeException e) { -+ MinecraftServer.getServer().scheduleOnMain(() -> new net.pl3x.purpur.event.ChunkTooLargeEvent(worldName, chunkX, chunkZ, true, true).callEvent()); // Purpur ++ new net.pl3x.purpur.event.ChunkTooLargeEvent(worldName, chunkX, chunkZ, true, true).callEvent(); // Purpur printOversizedLog("ChunkTooLarge even after reduction. Trying in overzealous mode.", regionfile.file, chunkX, chunkZ); // Eek, major fail. We have retry logic, so reduce threshholds and fall back SIZE_THRESHOLD = OVERZEALOUS_THRESHOLD; @@ -55,7 +55,7 @@ index d2b328945..103c0d1db 100644 DataInputStream datainputstream = regionfile.a(chunkcoordintpair); // Paper start if (regionfile.isOversized(chunkcoordintpair.x, chunkcoordintpair.z)) { -+ MinecraftServer.getServer().scheduleOnMain(() -> new net.pl3x.purpur.event.ChunkTooLargeEvent(worldName, chunkcoordintpair.x, chunkcoordintpair.z, false, false).callEvent()); // Purpur ++ new net.pl3x.purpur.event.ChunkTooLargeEvent(worldName, chunkcoordintpair.x, chunkcoordintpair.z, false, false).callEvent(); // Purpur printOversizedLog("Loading Oversized Chunk!", regionfile.file, chunkcoordintpair.x, chunkcoordintpair.z); return readOversizedChunk(regionfile, chunkcoordintpair); }