From 52fa44516e1448ccbad2dbf29860cead8516ac89 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Wed, 29 Dec 2021 16:47:34 +0000 Subject: [PATCH] Throw, catch, and rethrow our own exception to make sure we're finding the culprit to a possible shaded-FAWE. --- .../worldedit/world/block/BlockTypesCache.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypesCache.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypesCache.java index ac3672495..325da5140 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypesCache.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypesCache.java @@ -232,9 +232,16 @@ public class BlockTypesCache { defaultState = id; } if (values[internalId] != null) { - throw new IllegalStateException(String.format( - "Invalid duplicate id for %s! Something has gone very wrong. Are " + - "any plugins shading FAWE?!", id)); + // Ugly way of ensuring a stacktrace is printed so we can see the culprit. Rethrow because we still + // want to cancel whatever initialised the class. + try { + throw new IllegalStateException(String.format( + "Invalid duplicate id for %s! Something has gone very wrong. Are " + + "any plugins shading FAWE?!", id)); + } catch (IllegalStateException e) { + e.printStackTrace(); + throw e; + } } BlockType type = register(defaultState, internalId, stateList, tickList); // Note: Throws IndexOutOfBoundsError if nothing is registered and blocksMap is empty