Throw, catch, and rethrow our own exception to make sure we're finding the culprit to a possible shaded-FAWE.

This commit is contained in:
dordsor21 2021-12-29 16:47:34 +00:00
parent 9e8f0e7325
commit 52fa44516e
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B

View File

@ -232,9 +232,16 @@ public class BlockTypesCache {
defaultState = id; defaultState = id;
} }
if (values[internalId] != null) { if (values[internalId] != null) {
throw new IllegalStateException(String.format( // Ugly way of ensuring a stacktrace is printed so we can see the culprit. Rethrow because we still
"Invalid duplicate id for %s! Something has gone very wrong. Are " + // want to cancel whatever initialised the class.
"any plugins shading FAWE?!", id)); 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); BlockType type = register(defaultState, internalId, stateList, tickList);
// Note: Throws IndexOutOfBoundsError if nothing is registered and blocksMap is empty // Note: Throws IndexOutOfBoundsError if nothing is registered and blocksMap is empty