From 956f9a4d56e533a08e88896277ce9f7e9da06716 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 9 Jun 2024 12:07:55 +0200 Subject: made inChocolateFactory also work when feature is disabled --- .../chocolatefactory/ChocolateFactoryAPI.kt | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt index e9cfad554..c331c8f54 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt @@ -35,11 +35,11 @@ object ChocolateFactoryAPI { val patternGroup = RepoPattern.group("misc.chocolatefactory") val chocolateAmountPattern by patternGroup.pattern( "chocolate.amount", - "(?[\\d,]+) Chocolate" + "(?[\\d,]+) Chocolate", ) private val chocolateFactoryInventoryNamePattern by patternGroup.pattern( "inventory.name", - "Hoppity|Chocolate Factory Milestones" + "Hoppity|Chocolate Factory Milestones", ) var rabbitSlots = mapOf() @@ -78,19 +78,23 @@ object ChocolateFactoryAPI { @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { - if (!isEnabled()) return + if (!LorenzUtils.inSkyBlock) return if (chocolateFactoryInventoryNamePattern.matches(event.inventoryName)) { - chocolateFactoryPaused = true - ChocolateFactoryStats.updateDisplay() + if (config.enabled) { + chocolateFactoryPaused = true + ChocolateFactoryStats.updateDisplay() + } return } if (event.inventoryName != "Chocolate Factory") return inChocolateFactory = true - factoryUpgrades = emptyList() - DelayedRun.runNextTick { - ChocolateFactoryDataLoader.updateInventoryItems(event.inventoryItems) + if (config.enabled) { + factoryUpgrades = emptyList() + DelayedRun.runNextTick { + ChocolateFactoryDataLoader.updateInventoryItems(event.inventoryItems) + } } } -- cgit