Skip to content

Commit

Permalink
Fix: Time Tower usage warnings sending excessively (#2751)
Browse files Browse the repository at this point in the history
Co-authored-by: calwolfson <[email protected]>
  • Loading branch information
MTOnline69 and CalMWolfs authored Oct 18, 2024
1 parent df28fc4 commit 33a9608
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.",
Expand All @@ -68,7 +68,7 @@ object ChocolateFactoryTimeTowerManager {
)
SoundUtils.playBeepSound()
lastTimeTowerWarning = SimpleTimeMark.now()
warnedAboutLatestCharge = true
warnAboutNewCharge = false
}
checkTimeTowerWarning(false)
}
Expand Down

0 comments on commit 33a9608

Please sign in to comment.