aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt
index 9f7fbe367..6ffd8ed02 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt
@@ -22,6 +22,7 @@ import at.hannibal2.skyhanni.utils.TimeUtils.format
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.concurrent.fixedRateTimer
import kotlin.time.Duration
+import kotlin.time.Duration.Companion.INFINITE
import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.Duration.Companion.seconds
import kotlin.time.DurationUnit
@@ -129,7 +130,7 @@ class GardenVisitorTimer {
if (isSixthVisitorEnabled() && millis.isNegative()) {
visitorsAmount++
if (!sixthVisitorReady) {
- LorenzUtils.sendTitle("§a6th Visitor Ready", 5.seconds)
+ LorenzUtils.sendTitle("§a6th Vidsitor Ready", 5.seconds)
sixthVisitorReady = true
if (isSixthVisitorWarningEnabled()) SoundUtils.playBeepSound()
}
@@ -141,6 +142,15 @@ class GardenVisitorTimer {
millis -= sinceLastTimerUpdate
}
+ if (lastMillis == INFINITE) {
+ ErrorManager.logErrorState("Visitor Timer got problem detected", "lastMillis is infinite")
+ return
+ }
+ if (millis == INFINITE) {
+ ErrorManager.logErrorState("Visitor Timer got problem detected", "millis is infinite")
+ return
+ }
+
val diff = lastMillis - millis
if (diff == 0.seconds && visitorsAmount == lastVisitors) return
lastMillis = millis