aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorMTOnline69 <97001154+MTOnline69@users.noreply.github.com>2024-10-16 12:42:44 +0100
committerGitHub <noreply@github.com>2024-10-16 13:42:44 +0200
commit9e97dff77ac15011d42c6db684e3f686b2efa926 (patch)
treed1e7f754f43e3232639fd4d771da6e031d513111 /src/main/java/at
parent1d79bb1e97153db7f32df4bb46b7a97c2cfd0ff3 (diff)
downloadskyhanni-9e97dff77ac15011d42c6db684e3f686b2efa926.tar.gz
skyhanni-9e97dff77ac15011d42c6db684e3f686b2efa926.tar.bz2
skyhanni-9e97dff77ac15011d42c6db684e3f686b2efa926.zip
Improvement: Stop Time Tower Usage Warning spam (#2730)
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt26
1 files changed, 16 insertions, 10 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 30af77ac8..39e0df3da 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
@@ -12,7 +12,6 @@ import at.hannibal2.skyhanni.utils.SoundUtils
import at.hannibal2.skyhanni.utils.StringUtils
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration
-import kotlin.time.Duration.Companion.hours
import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.seconds
@@ -23,6 +22,7 @@ object ChocolateFactoryTimeTowerManager {
private val profileStorage get() = ChocolateFactoryAPI.profileStorage
private var lastTimeTowerWarning = SimpleTimeMark.farPast()
+ private var warnedAboutLatestCharge = false
private var wasTimeTowerRecentlyActive = false
@SubscribeEvent
@@ -45,24 +45,30 @@ object ChocolateFactoryTimeTowerManager {
if (ChocolateFactoryAPI.inChocolateFactory) return
- val nextCharge = profileStorage.nextTimeTower
-
- if (nextCharge.isInPast() && !nextCharge.isFarPast() && currentCharges() < maxCharges()) {
- profileStorage.currentTimeTowerUses++
-
- val nextTimeTower = profileStorage.nextTimeTower + profileStorage.timeTowerCooldown.hours
- profileStorage.nextTimeTower = nextTimeTower
+ if (timeTowerFullTimeMark().isInPast()) {
+ profileStorage.currentTimeTowerUses = maxCharges()
+ } else {
+ var nextCharge = profileStorage.nextTimeTower
+ while (nextCharge.isInPast() && !nextCharge.isFarPast()) {
+ profileStorage.currentTimeTowerUses++
+ nextCharge += ChocolateFactoryAPI.timeTowerChargeDuration()
+ profileStorage.nextTimeTower = nextCharge
+ warnedAboutLatestCharge = false
+ }
+ }
+ if (currentCharges() < maxCharges()) {
if (!config.timeTowerWarning || timeTowerActive()) return
+ if (warnedAboutLatestCharge) return
ChatUtils.clickableChat(
- "Your Time Tower has another charge available §7(${timeTowerCharges()})§e, " +
+ "Your Time Tower has an available charge §7(${timeTowerCharges()})§e. " +
"Click here to use one.",
onClick = { HypixelCommands.chocolateFactory() },
HOVER_TEXT,
)
SoundUtils.playBeepSound()
lastTimeTowerWarning = SimpleTimeMark.now()
- return
+ warnedAboutLatestCharge = true
}
checkTimeTowerWarning(false)
}