aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt9
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()}")