From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown 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 index 1f02038ac259529b555672978867128761d1bd39..33cb25555401203ff0760872e5b5243d508cb003 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -298,4 +298,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 index bc8eb90c154a3c95f38e275058b620f4c433ac9b..c00a3bdca49946ab3ca1864da3f27e0f05033ff6 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -640,6 +640,12 @@ public class Chunk implements IChunkAccess { "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 }