Paper/Spigot-Server-Patches/0121-Option-to-remove-corrupt-tile-entities.patch

41 lines
1.7 KiB
Diff
Raw Normal View History

2019-05-14 04:20:58 +02:00
From 94dfb8f25bd8fce92c3befc3a08a5a8fa1e342d6 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 5 Oct 2016 16:27:36 -0500
Subject: [PATCH] Option to remove corrupt tile entities
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
2019-05-14 04:20:58 +02:00
index 92ab55182..eed454bf4 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
2019-04-27 08:26:04 +02:00
@@ -296,4 +296,9 @@ public class PaperWorldConfig {
preventTntFromMovingInWater = getBoolean("prevent-tnt-from-moving-in-water", false);
log("Prevent TNT from moving in water: " + preventTntFromMovingInWater);
}
+
+ public boolean removeCorruptTEs = false;
+ private void removeCorruptTEs() {
+ removeCorruptTEs = getBoolean("remove-corrupt-tile-entities", false);
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
2019-05-14 04:20:58 +02:00
index c2865425d..7382a47d8 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
2019-05-14 04:20:58 +02:00
@@ -528,6 +528,12 @@ public class Chunk implements IChunkAccess {
2019-04-27 08:26:04 +02:00
"Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16));
e.printStackTrace();
ServerInternalException.reportInternalException(e);
+
+ if (this.world.paperConfig.removeCorruptTEs) {
+ this.removeTileEntity(tileentity.getPosition());
+ this.markDirty();
+ org.bukkit.Bukkit.getLogger().info("Removing corrupt tile entity");
+ }
// Paper end
// CraftBukkit end
}
--
2.21.0