From e2e03722f8db36b51597cb254b889e3ce94b1dfa Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 17 Nov 2023 11:22:47 +0100 Subject: Using duration and SimpleTimeMark in GardenVisitorTimer. Added TimeUtils.getDuration and deprecated TimeUtils.getMillis --- .../features/garden/visitor/GardenVisitorTimer.kt | 57 ++++++++++++---------- .../at/hannibal2/skyhanni/utils/SimpleTimeMark.kt | 12 ++++- .../java/at/hannibal2/skyhanni/utils/TimeUtils.kt | 14 ++++-- 3 files changed, 51 insertions(+), 32 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni') 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 06bb732cc..7e26e900b 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 @@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.SimpleTimeMark +import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.asTimeMark import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -20,16 +21,18 @@ import at.hannibal2.skyhanni.utils.TimeUtils import at.hannibal2.skyhanni.utils.TimeUtils.format import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.concurrent.fixedRateTimer -import kotlin.math.roundToLong +import kotlin.time.Duration import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds +import kotlin.time.DurationUnit +import kotlin.time.toDuration class GardenVisitorTimer { private val config get() = SkyHanniMod.feature.garden.visitors.timer private val pattern = "§b§lVisitors: §r§f\\((?