Files
Purpur/patches/server/0037-Implement-ChunkTooLargeEvent.patch
William Blake Galbreath 2d212d6e78 Updated Upstream (Paper)
Upstream has released updates that appears to apply and compile correctly

Paper Changes:
7caed1a8 [CI-SKIP] Rebuild patches
777073a5 Check horse entity validity in container interactions (#2584)
d69fe6c5 Fix zero-tick instant grow farms MC-113809 (#2559)
c68dbb86 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#2576)
1e521994 Update Paperclip
30f9955e Fix race conditions in flush allowing for previously scheduled tasks to execute later than the flush call (#2548)
9e1620e3 Improve save logic (#2485)
72860501 [CI-SKIP] Fix duplicate patch number
87355875 Fix nether portal frame creation (#2546)
26acc9b7 Re-add flat bedrock config option
2019-09-26 11:40:21 -05:00

65 lines
3.6 KiB
Diff

From fdf5cf1d6672ea52a1e10f27e78c89e4462475de Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Fri, 12 Jul 2019 02:10:06 -0500
Subject: [PATCH] Implement ChunkTooLargeEvent
---
src/main/java/net/minecraft/server/RegionFileCache.java | 6 ++++++
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 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 {
private final File actualWorld;
private boolean useAltWorld;
// Paper end
+ private final String worldName; // Purpur
protected RegionFileCache(File file) {
@@ -35,6 +36,7 @@ public abstract class RegionFileCache implements AutoCloseable {
if (name.equals("DIM-1") || name.equals("DIM1")) {
container = container.getParentFile();
}
+ worldName = container.getName(); // Purpur
this.templateWorld = new File(container, name);
File region = new File(file, "region");
if (!region.exists()) {
@@ -43,6 +45,7 @@ public abstract class RegionFileCache implements AutoCloseable {
} else {
this.useAltWorld = false;
this.templateWorld = file;
+ worldName = file.getParentFile().getParentFile().getName(); // Purpur
}
// Paper start
}
@@ -119,6 +122,7 @@ public abstract class RegionFileCache implements AutoCloseable {
regionfile.setStatus(chunk.x, chunk.z, ChunkRegionLoader.getStatus(nbttagcompound)); // Paper - cache status on disk
regionfile.setOversized(chunkX, chunkZ, false);
} catch (RegionFile.ChunkTooLargeException ignored) {
+ 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();
@@ -136,6 +140,7 @@ public abstract class RegionFileCache implements AutoCloseable {
}
regionfile.setStatus(chunk.x, chunk.z, ChunkRegionLoader.getStatus(nbttagcompound)); // Paper - cache status on disk
} catch (RegionFile.ChunkTooLargeException e) {
+ 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;
@@ -242,6 +247,7 @@ public abstract class RegionFileCache implements AutoCloseable {
DataInputStream datainputstream = regionfile.a(chunkcoordintpair);
// Paper start
if (regionfile.isOversized(chunkcoordintpair.x, chunkcoordintpair.z)) {
+ 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);
}
--
2.23.0.rc1