From 2a2540e76c62831b42094785d70a1952607174fb Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 23 Apr 2016 11:57:39 -0400 Subject: [PATCH] improve the jackass test --- ...ount-additions-and-mark-entities-remov.patch | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Spigot-Server-Patches/Check-entity-count-additions-and-mark-entities-remov.patch b/Spigot-Server-Patches/Check-entity-count-additions-and-mark-entities-remov.patch index 33091a78ed..6f5fdaa970 100644 --- a/Spigot-Server-Patches/Check-entity-count-additions-and-mark-entities-remov.patch +++ b/Spigot-Server-Patches/Check-entity-count-additions-and-mark-entities-remov.patch @@ -13,8 +13,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + // Paper start - Try to catch plugins doing indecent things -+ if (entity.aa && entity.getChunkX() == this.locX && entity.getChunkY() == k && entity.getChunkZ() == this.locZ) { -+ throw new IllegalStateException("Hey Jackass don't do that."); ++ if (entity.aa) { ++ boolean thisChunk = entity.getChunkX() == this.locX && entity.getChunkY() == k && entity.getChunkZ() == this.locZ; ++ String chunkName = entity.getWorld().getWorld().getName() + ":" + entity.getChunkX() + "," + entity.getChunkY() + "," + entity.getChunkZ(); ++ if (!thisChunk) { ++ throw new IllegalStateException("Entity Already in another chunk: " + chunkName); ++ } else if (this.entitySlices[k].contains(entity)) { ++ throw new IllegalStateException("Double Chunk Add to: " + chunkName); ++ } else { ++ for (int i1 = 0; i1 < this.entitySlices.length; i1++) { ++ if (this.entitySlices[i1].contains(entity)) { ++ throw new IllegalStateException("Entity was found in another slice of this chunk, tried: " + k + ", was in: " + chunkName); ++ } ++ } ++ new Throwable("Improperly detected double chunk add. Was not actually in this chunk.").printStackTrace(); ++ } + } + // Paper end +