diff options
author | J10a1n15 <45315647+j10a1n15@users.noreply.github.com> | 2024-06-09 21:07:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-09 21:07:40 +0200 |
commit | 32806b65dc90301b33591a631fd3b4a9ffacf229 (patch) | |
tree | 7804c92fc9b33a66cf83108925c26391a72494d9 /src/main/java/at | |
parent | 784036070571db1e94911c0272311a4f052a66fc (diff) | |
download | skyhanni-32806b65dc90301b33591a631fd3b4a9ffacf229.tar.gz skyhanni-32806b65dc90301b33591a631fd3b4a9ffacf229.tar.bz2 skyhanni-32806b65dc90301b33591a631fd3b4a9ffacf229.zip |
Fix: Perkapocalypse Max Time (#2045)
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt | 9 |
1 files 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<Mayor?, SimpleTimeMark> = 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()}") |