From fc8016345d63a42d740e290ba7717d06444d2e8f Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Tue, 29 Aug 2023 22:32:25 +0200 Subject: using kotlin duration in TitleUtils --- .../java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt | 3 ++- .../at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt | 5 +++-- .../java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt index 2272cdd62..610acc9a2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt @@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.TimeUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.seconds class ServerRestartTitle { private val config get() = SkyHanniMod.feature.misc @@ -29,7 +30,7 @@ class ServerRestartTitle { if (totalSeconds % 30 != 0) return } val time = TimeUtils.formatDuration(totalSeconds.toLong() * 1000) - TitleUtils.sendTitle("§cServer Restart in §b$time", 2_000) + TitleUtils.sendTitle("§cServer Restart in §b$time", 2.seconds) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt index 11c0504d8..c1b4ee3fc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt @@ -26,6 +26,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.lwjgl.input.Keyboard import kotlin.concurrent.fixedRateTimer +import kotlin.time.Duration.Companion.seconds class TrevorFeatures { @@ -69,7 +70,7 @@ class TrevorFeatures { if (event.message == "§aReturn to the Trapper soon to get a new animal to hunt!") { TrevorSolver.resetLocation() if (config.trapperMobDiedMessage) { - TitleUtils.sendTitle("§2Mob Died ", 5_000) + TitleUtils.sendTitle("§2Mob Died ", 5.seconds) SoundUtils.playBeepSound() } trapperReady = true @@ -114,7 +115,7 @@ class TrevorFeatures { if (timeUntilNextReady <= 0 && trapperReady) { if (timeUntilNextReady == 0) { - TitleUtils.sendTitle("§2Trapper Ready", 3_000) + TitleUtils.sendTitle("§2Trapper Ready", 3.seconds) SoundUtils.playBeepSound() } currentStatus = TrapperStatus.READY diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt index 4275e4698..475a9fda1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt @@ -14,6 +14,7 @@ import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.passive.EntityChicken +import kotlin.time.Duration.Companion.seconds object TrevorSolver { private val animalHealths = intArrayOf(100, 200, 400, 500, 1000, 2000, 5000, 10000, 20000) //future proofing for Derpy :) @@ -79,7 +80,7 @@ object TrevorSolver { } if (canSee) { if (mobLocation != CurrentMobArea.FOUND) { - TitleUtils.sendTitle("§2Saw Mob!", 3_000) + TitleUtils.sendTitle("§2Saw Mob!", 3.seconds) } mobLocation = CurrentMobArea.FOUND mobCoordinates = entity.position.toLorenzVec() -- cgit