From 32806b65dc90301b33591a631fd3b4a9ffacf229 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sun, 9 Jun 2024 21:07:40 +0200 Subject: Fix: Perkapocalypse Max Time (#2045) --- src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt index 0f9ab9157..1c759a17d 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt @@ -89,7 +89,7 @@ object MayorAPI { private var lastMayor: Mayor? = null var jerryExtraMayor: Pair = null to SimpleTimeMark.farPast() private set - var lastJerryExtraMayorReminder = SimpleTimeMark.farPast() + private var lastJerryExtraMayorReminder = SimpleTimeMark.farPast() private var lastUpdate = SimpleTimeMark.farPast() private var dispatcher = Dispatchers.IO @@ -167,8 +167,11 @@ object MayorAPI { val jerryMayor = getMayorFromPerk(getPerkFromName(perk.removeColor()) ?: return)?.addAllPerks() ?: return val lastMayorTimestamp = nextMayorTimestamp - SKYBLOCK_YEAR_MILLIS.milliseconds - - val expireTime = (1..21).map { lastMayorTimestamp + (6.hours * it) }.first { it.isInFuture() } + + val expireTime = (1..21) + .map { lastMayorTimestamp + (6.hours * it) } + .firstOrNull { it.isInFuture() } + ?.coerceAtMost(nextMayorTimestamp) ?: return ChatUtils.debug("Jerry Mayor found: ${jerryMayor.name} expiring at: ${expireTime.timeUntil()}") -- cgit