summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/dungeon
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-05-26 23:02:48 +1000
committerGitHub <noreply@github.com>2024-05-26 15:02:48 +0200
commitf67af16eacb6cdf3598183d473f072d123ef8a25 (patch)
tree62d11d0f5191d48eee31a630a0b054baeb89a509 /src/main/java/at/hannibal2/skyhanni/features/dungeon
parent29657e24412baa7be9a1681593593368f92de26f (diff)
downloadskyhanni-f67af16eacb6cdf3598183d473f072d123ef8a25.tar.gz
skyhanni-f67af16eacb6cdf3598183d473f072d123ef8a25.tar.bz2
skyhanni-f67af16eacb6cdf3598183d473f072d123ef8a25.zip
Backend: Convert stuff to SimpleTimeMark (#1777)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/dungeon')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt
index 2e6832eb1..960a8053e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt
@@ -8,27 +8,29 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
+import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import kotlin.time.Duration.Companion.seconds
object DungeonMilestonesDisplay {
private val config get() = SkyHanniMod.feature.dungeon
- val milestonePattern by RepoPattern.pattern(
+ private val milestonePattern by RepoPattern.pattern(
"dungeon.milestone",
"§e§l.*Milestone §r§e.§r§7: You have (?:tanked and )?(?:dealt|healed) §r§.*§r§7.*so far! §r§a.*"
)
private var display = ""
private var currentMilestone = 0
- private var timeReached = 0L
+ private var timeReached = SimpleTimeMark.farPast()
var colour = ""
@SubscribeEvent
fun onTick(event: LorenzTickEvent) {
if (!event.isMod(5)) return
- if (currentMilestone >= 3 && System.currentTimeMillis() > timeReached + 3_000 && display.isNotEmpty()) {
+ if (currentMilestone >= 3 && timeReached.passedSince() > 3.seconds && display.isNotEmpty()) {
display = display.substring(1)
}
}
@@ -47,7 +49,7 @@ object DungeonMilestonesDisplay {
private fun update() {
if (currentMilestone > 3) return
if (currentMilestone == 3) {
- timeReached = System.currentTimeMillis()
+ timeReached = SimpleTimeMark.now()
}
colour = when (currentMilestone) {