From 026b9ce322f230ffb33672f6605f96df6958382e Mon Sep 17 00:00:00 2001 From: Intelli Date: Thu, 8 Dec 2022 13:56:14 -0700 Subject: [PATCH] Fixed IllegalStateException when modifying containers using FAWE --- .../coreprotect/worldedit/CoreProtectEditSessionEvent.java | 4 ++++ .../java/net/coreprotect/worldedit/CoreProtectLogger.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/coreprotect/worldedit/CoreProtectEditSessionEvent.java b/src/main/java/net/coreprotect/worldedit/CoreProtectEditSessionEvent.java index 02ec00f..e170641 100755 --- a/src/main/java/net/coreprotect/worldedit/CoreProtectEditSessionEvent.java +++ b/src/main/java/net/coreprotect/worldedit/CoreProtectEditSessionEvent.java @@ -26,6 +26,10 @@ public class CoreProtectEditSessionEvent { return initialized; } + public static boolean isFAWE() { + return isFAWE; + } + public static void register() { if (isInitialized()) { return; diff --git a/src/main/java/net/coreprotect/worldedit/CoreProtectLogger.java b/src/main/java/net/coreprotect/worldedit/CoreProtectLogger.java index 7af48ea..49db4f0 100755 --- a/src/main/java/net/coreprotect/worldedit/CoreProtectLogger.java +++ b/src/main/java/net/coreprotect/worldedit/CoreProtectLogger.java @@ -46,7 +46,7 @@ public class CoreProtectLogger extends AbstractDelegateExtent { // No clear way to get container content data from within the WorldEdit API // Data may be available by converting oldBlock.toBaseBlock().getNbtData() // e.g. BaseBlock block = eventWorld.getBlock(position); - ItemStack[] containerData = Util.getContainerContents(oldType, null, location); + ItemStack[] containerData = CoreProtectEditSessionEvent.isFAWE() ? null : Util.getContainerContents(oldType, null, location); if (eventExtent.setBlock(position, block)) { WorldEditLogger.postProcess(eventExtent, eventActor, position, location, block, baseBlock, oldType, oldBlock, containerData);