diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-18 11:10:07 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-18 11:10:07 +0100 |
commit | 9424c441414f6d9f25b3e1599d7d3d0fcaf09c3a (patch) | |
tree | eae1cc93e5542007a33a3ed9784d65bea966ac78 /src/main/java/at/hannibal2/skyhanni | |
parent | 392634b043f7203e27c623f6c3542a1772d028d2 (diff) | |
download | skyhanni-9424c441414f6d9f25b3e1599d7d3d0fcaf09c3a.tar.gz skyhanni-9424c441414f6d9f25b3e1599d7d3d0fcaf09c3a.tar.bz2 skyhanni-9424c441414f6d9f25b3e1599d7d3d0fcaf09c3a.zip |
added check for errors in visitor timer
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt | 12 |
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 |