From f5db9b0d5501cc566bbd7bf078f00527cafc1f08 Mon Sep 17 00:00:00 2001 From: Michael Hillcox Date: Sat, 20 Jul 2024 20:01:51 +0100 Subject: [PATCH] fix: don't read config on unload event --- gradle.properties | 4 ++-- .../java/cpw/mods/inventorysorter/InventorySorter.java | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 1a0642f..b087b89 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,5 +2,5 @@ # This is required to provide enough memory for the Minecraft decompilation process. org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false -neo_version=21.0.86-beta -mc_version=1.21 \ No newline at end of file +neo_version=21.0.110-beta +mc_version=1.21 diff --git a/src/main/java/cpw/mods/inventorysorter/InventorySorter.java b/src/main/java/cpw/mods/inventorysorter/InventorySorter.java index 539a9f6..971cc32 100644 --- a/src/main/java/cpw/mods/inventorysorter/InventorySorter.java +++ b/src/main/java/cpw/mods/inventorysorter/InventorySorter.java @@ -52,8 +52,7 @@ */ @Mod("inventorysorter") -public class InventorySorter -{ +public class InventorySorter { public static InventorySorter INSTANCE; static final Logger LOGGER = LogManager.getLogger(); @@ -112,7 +111,13 @@ boolean isSlotBlacklisted(Slot slot) { boolean isContainerBlacklisted(ResourceLocation container) { return containerblacklist.contains(container.toString()) || Config.ServerConfig.CONFIG.containerBlacklist.get().contains(container.toString()); } + void onConfigLoad(ModConfigEvent configEvent) { + // Don't load data on unloading + if (configEvent instanceof ModConfigEvent.Unloading) { + return; + } + switch (configEvent.getConfig().getType()) { case SERVER: this.slotblacklist.addAll(Config.ServerConfig.CONFIG.slotBlacklist.get());