From 33a960897d877b329b0f1eb2cffc7bc6cdc9c341 Mon Sep 17 00:00:00 2001 From: MTOnline69 <97001154+MTOnline69@users.noreply.github.com> Date: Fri, 18 Oct 2024 17:39:39 +0100 Subject: [PATCH] Fix: Time Tower usage warnings sending excessively (#2751) Co-authored-by: calwolfson --- .../ChocolateFactoryTimeTowerManager.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt index 39e0df3da460..6ee1cb687343 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt @@ -22,7 +22,7 @@ object ChocolateFactoryTimeTowerManager { private val profileStorage get() = ChocolateFactoryAPI.profileStorage private var lastTimeTowerWarning = SimpleTimeMark.farPast() - private var warnedAboutLatestCharge = false + private var warnAboutNewCharge = false private var wasTimeTowerRecentlyActive = false @SubscribeEvent @@ -53,13 +53,13 @@ object ChocolateFactoryTimeTowerManager { profileStorage.currentTimeTowerUses++ nextCharge += ChocolateFactoryAPI.timeTowerChargeDuration() profileStorage.nextTimeTower = nextCharge - warnedAboutLatestCharge = false + warnAboutNewCharge = true } } - if (currentCharges() < maxCharges()) { + if (currentCharges() > 0 && currentCharges() < maxCharges()) { if (!config.timeTowerWarning || timeTowerActive()) return - if (warnedAboutLatestCharge) return + if (!warnAboutNewCharge) return ChatUtils.clickableChat( "Your Time Tower has an available charge §7(${timeTowerCharges()})§e. " + "Click here to use one.", @@ -68,7 +68,7 @@ object ChocolateFactoryTimeTowerManager { ) SoundUtils.playBeepSound() lastTimeTowerWarning = SimpleTimeMark.now() - warnedAboutLatestCharge = true + warnAboutNewCharge = false } checkTimeTowerWarning(false) }