diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-29 22:32:25 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-29 22:32:25 +0200 |
commit | fc8016345d63a42d740e290ba7717d06444d2e8f (patch) | |
tree | 4aae3e324d04c436440fafb575cb689861a9ce84 /src/main/java | |
parent | e30585a3323be457dea81b4bc33b020c8547cf54 (diff) | |
download | skyhanni-fc8016345d63a42d740e290ba7717d06444d2e8f.tar.gz skyhanni-fc8016345d63a42d740e290ba7717d06444d2e8f.tar.bz2 skyhanni-fc8016345d63a42d740e290ba7717d06444d2e8f.zip |
using kotlin duration in TitleUtils
Diffstat (limited to 'src/main/java')
24 files changed, 58 insertions, 33 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/TitleUtils.kt b/src/main/java/at/hannibal2/skyhanni/data/TitleUtils.kt index d66a321b2..2004a1ed1 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/TitleUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/TitleUtils.kt @@ -2,34 +2,36 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.PreProfileSwitchEvent +import at.hannibal2.skyhanni.utils.SimpleTimeMark import io.github.moulberry.moulconfig.internal.TextRenderUtils import net.minecraft.client.Minecraft import net.minecraft.client.gui.ScaledResolution import net.minecraft.client.renderer.GlStateManager import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration class TitleUtils { companion object { private var display = "" - private var endTime = 0L + private var endTime = SimpleTimeMark.farPast() private var heightModifier = 1.8 - fun sendTitle(text: String, duration: Int, height: Double = 1.8) { + fun sendTitle(text: String, duration: Duration, height: Double = 1.8) { display = "§f$text" - endTime = System.currentTimeMillis() + duration + endTime = SimpleTimeMark.now() + duration heightModifier = height } } @SubscribeEvent fun onPreProfileSwitch(event: PreProfileSwitchEvent) { - sendTitle("", 1) + endTime = SimpleTimeMark.farPast() } @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { - if (System.currentTimeMillis() > endTime) return + if (endTime.isInPast()) return val scaledResolution = ScaledResolution(Minecraft.getMinecraft()) val width = scaledResolution.scaledWidth diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt index ae956f2d8..4ebdc1ffa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt @@ -16,6 +16,7 @@ import io.github.moulberry.notenoughupdates.recipes.CraftingRecipe import net.minecraft.client.Minecraft import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.seconds class MinionCraftHelper { private var minionNamePattern = "(?<name>.*) Minion (?<number>.*)".toPattern() @@ -248,7 +249,7 @@ class MinionCraftHelper { private fun notify(minionName: String) { if (alreadyNotified.contains(minionName)) return - TitleUtils.sendTitle("Can craft $minionName", 3_000) + TitleUtils.sendTitle("Can craft $minionName", 3.seconds) alreadyNotified.add(minionName) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt index f979894c4..5a578590f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt @@ -24,7 +24,7 @@ class GriffinPetWarning { if (!DianaAPI.hasGriffinPet()) { if (lastWarnTime.passedSince() > 30.seconds) { lastWarnTime = SimpleTimeMark.now() - TitleUtils.sendTitle("§cGriffin Pet!", 3_000) + TitleUtils.sendTitle("§cGriffin Pet!", 3.seconds) LorenzUtils.chat("§e[SkyHanni] Reminder to use a Griffin pet for Mythological Ritual!") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt index 272ec5f61..7a8ea5d2b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt @@ -226,7 +226,7 @@ object InquisitorWaypointShare { if (!waypoints.containsKey(cleanName)) { LorenzUtils.chat("§e[SkyHanni] $playerName §l§efound an inquisitor at §l§c$x $y $z!") if (cleanName != LorenzUtils.getPlayerName()) { - TitleUtils.sendTitle("§dINQUISITOR §efrom §b$cleanName", 5_000) + TitleUtils.sendTitle("§dINQUISITOR §efrom §b$cleanName", 5.seconds) SoundUtils.playBeepSound() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt index 9ec766953..1c02e4cc8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -29,6 +29,7 @@ import javax.swing.JButton import javax.swing.JFrame import javax.swing.JOptionPane import javax.swing.UIManager +import kotlin.time.Duration.Companion.seconds object GardenNextJacobContest { private var display = emptyList<Any>() @@ -314,7 +315,7 @@ object GardenNextJacobContest { val cropText = crops.joinToString("§7, ") { "§a${it.cropName}" } LorenzUtils.chat("§e[SkyHanni] Next farming contest: $cropText") - TitleUtils.sendTitle("§eFarming Contest!", 5_000) + TitleUtils.sendTitle("§eFarming Contest!", 5.seconds) SoundUtils.playBeepSound() if (config.nextJacobContestWarnPopup && !Display.isActive()) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt index 6f5e9abe0..71ac8b321 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt @@ -16,6 +16,7 @@ import net.minecraft.client.gui.inventory.GuiEditSign import net.minecraftforge.client.event.GuiOpenEvent import net.minecraftforge.client.event.GuiScreenEvent.DrawScreenEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.seconds class GardenOptimalSpeed { private val config get() = SkyHanniMod.feature.garden @@ -100,7 +101,7 @@ class GardenOptimalSpeed { if (System.currentTimeMillis() < lastWarnTime + 20_000) return lastWarnTime = System.currentTimeMillis() - TitleUtils.sendTitle("§cWrong speed!", 3_000) + TitleUtils.sendTitle("§cWrong speed!", 3.seconds) cropInHand?.let { LorenzUtils.chat("§e[SkyHanni] Wrong speed for ${it.cropName}: §f$currentSpeed §e(§f$optimalSpeed §eis optimal)") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt index 38132e8b6..2f88c52de 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt @@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.utils.TimeUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.* import kotlin.time.Duration +import kotlin.time.Duration.Companion.seconds import kotlin.time.DurationUnit class ComposterDisplay { @@ -142,7 +143,7 @@ class ComposterDisplay { if (ComposterAPI.getOrganicMatter() <= config.composterNotifyLowOrganicMatter) { if (System.currentTimeMillis() >= hidden.informedAboutLowMatter) { if (config.composterNotifyLowTitle) { - TitleUtils.sendTitle("§cYour Organic Matter is low", 4_000) + TitleUtils.sendTitle("§cYour Organic Matter is low", 4.seconds) } LorenzUtils.chat("§e[SkyHanni] §cYour Organic Matter is low!") hidden.informedAboutLowMatter = System.currentTimeMillis() + 60_000 * 5 @@ -153,7 +154,7 @@ class ComposterDisplay { System.currentTimeMillis() >= hidden.informedAboutLowFuel ) { if (config.composterNotifyLowTitle) { - TitleUtils.sendTitle("§cYour Fuel is low", 4_000) + TitleUtils.sendTitle("§cYour Fuel is low", 4.seconds) } LorenzUtils.chat("§e[SkyHanni] §cYour Fuel is low!") hidden.informedAboutLowFuel = System.currentTimeMillis() + 60_000 * 5 @@ -203,6 +204,6 @@ class ComposterDisplay { if (System.currentTimeMillis() < storage.lastComposterEmptyWarningTime + 1000 * 60 * 2) return storage.lastComposterEmptyWarningTime = System.currentTimeMillis() LorenzUtils.chat("§e[SkyHanni] $warningMessage") - TitleUtils.sendTitle("§eComposter Warning!", 3_000) + TitleUtils.sendTitle("§eComposter Warning!", 3.seconds) } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBurrowingSporesNotifier.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBurrowingSporesNotifier.kt index 73d5bcaea..8d67434de 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBurrowingSporesNotifier.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBurrowingSporesNotifier.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.data.TitleUtils import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.seconds class GardenBurrowingSporesNotifier { @@ -14,7 +15,7 @@ class GardenBurrowingSporesNotifier { if (!SkyHanniMod.feature.garden.burrowingSporesNotification) return if (event.message.endsWith("§6§lVERY RARE CROP! §r§f§r§9Burrowing Spores")) { - TitleUtils.sendTitle("§9Burrowing Spores!", 5_000) + TitleUtils.sendTitle("§9Burrowing Spores!", 5.seconds) // would be sent too often, nothing special then // ItemBlink.setBlink(NEUItems.getItemStackOrNull("BURROWING_SPORES"), 5_000) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt index dad33a902..03b9ea809 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt @@ -23,6 +23,7 @@ import at.hannibal2.skyhanni.utils.TimeUtils import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.* +import kotlin.time.Duration.Companion.seconds object GardenCropMilestoneDisplay { private var progressDisplay = emptyList<List<Any>>() @@ -215,7 +216,7 @@ object GardenCropMilestoneDisplay { SoundUtils.playBeepSound() } if (!needsInventory) { - TitleUtils.sendTitle(title, 1_500) + TitleUtils.sendTitle(title, 1.5.seconds) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt index 9c2d38e4b..171f3c989 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt @@ -13,6 +13,7 @@ import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.SoundUtils import io.github.moulberry.notenoughupdates.util.MinecraftExecutor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.seconds class WildStrawberryDyeNotification { var lastCloseTime = 0L @@ -36,7 +37,7 @@ class WildStrawberryDyeNotification { val internalName = event.itemStack.getInternalName_old() if (internalName == "DYE_WILD_STRAWBERRY") { val name = event.itemStack.name!! - TitleUtils.sendTitle(name, 5_000) + TitleUtils.sendTitle(name, 5.seconds) LorenzUtils.chat("§e[SkyHanni] You found a $name§e!") SoundUtils.playBeepSound() ItemBlink.setBlink(NEUItems.getItemStackOrNull("DYE_WILD_STRAWBERRY"), 5_000) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WrongFungiCutterWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WrongFungiCutterWarning.kt index 76a5b50ad..916c31524 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WrongFungiCutterWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WrongFungiCutterWarning.kt @@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.SoundUtils import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.seconds class WrongFungiCutterWarning { private var mode = FungiMode.UNKNOWN @@ -48,7 +49,7 @@ class WrongFungiCutterWarning { private fun notifyWrong() { if (!SkyHanniMod.feature.garden.fungiCutterWarn) return - TitleUtils.sendTitle("§cWrong Fungi Cutter Mode!", 2_000) + TitleUtils.sendTitle("§cWrong Fungi Cutter Mode!", 2.seconds) if (System.currentTimeMillis() > lastPlaySoundTime + 3_00) { lastPlaySoundTime = System.currentTimeMillis() SoundUtils.playBeepSound() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 77909ff74..98975b61d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -44,6 +44,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.lwjgl.input.Keyboard import kotlin.math.round +import kotlin.time.Duration.Companion.seconds private val config get() = SkyHanniMod.feature.garden @@ -535,7 +536,7 @@ class GardenVisitorFeatures { logger.log("New visitor detected: '$name'") if (config.visitorNotificationTitle && System.currentTimeMillis() > LorenzUtils.lastWorldSwitch + 2_000) { - TitleUtils.sendTitle("§eNew Visitor", 5_000) + TitleUtils.sendTitle("§eNew Visitor", 5.seconds) } if (config.visitorNotificationChat) { val displayName = GardenVisitorColorNames.getColoredName(name) 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 c17ebf721..ce1ee97bc 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 @@ -13,6 +13,7 @@ import at.hannibal2.skyhanni.utils.TimeUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.concurrent.fixedRateTimer import kotlin.math.roundToLong +import kotlin.time.Duration.Companion.seconds class GardenVisitorTimer { private val config get() = SkyHanniMod.feature.garden @@ -111,7 +112,7 @@ class GardenVisitorTimer { if (isSixthVisitorEnabled() && millis < 0) { visitorsAmount++ if (!sixthVisitorReady) { - TitleUtils.sendTitle("§a6th Visitor Ready", 5_000) + TitleUtils.sendTitle("§a6th Visitor Ready", 5.seconds) sixthVisitorReady = true if (isSixthVisitorWarningEnabled()) SoundUtils.playBeepSound() } 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() diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/ShyCruxWarnings.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/ShyCruxWarnings.kt index ad38e3cfe..84808625a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/ShyCruxWarnings.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/ShyCruxWarnings.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.milliseconds class ShyCruxWarnings { private val config get() = RiftAPI.config.area.wyldWoodsConfig @@ -21,7 +22,7 @@ class ShyCruxWarnings { private fun checkForShy() { if (EntityUtils.getAllEntities().any { it.name in shyNames && it.distanceToPlayer() < 8 }) { - TitleUtils.sendTitle("§eLook away!", 150) + TitleUtils.sendTitle("§eLook away!", 150.milliseconds) } } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerBossSpawnSoon.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerBossSpawnSoon.kt index 0ab6eb997..1d8dd0698 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerBossSpawnSoon.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerBossSpawnSoon.kt @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.seconds class SlayerBossSpawnSoon { @@ -28,7 +29,7 @@ class SlayerBossSpawnSoon { if (completion > config.percent / 100.0) { if (!warned || (config.repeat && completion != lastCompletion)) { SoundUtils.playBeepSound() - TitleUtils.sendTitle("§cSlayer boss soon!", 2_000) + TitleUtils.sendTitle("§cSlayer boss soon!", 2.seconds) warned = true } } else { diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt index c402becdb..8130526f4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt @@ -29,6 +29,7 @@ import net.minecraft.network.play.server.S0DPacketCollectItem import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.concurrent.TimeUnit +import kotlin.time.Duration.Companion.seconds object SlayerItemProfitTracker { private val config get() = SkyHanniMod.feature.slayer.itemProfitTracker @@ -148,7 +149,7 @@ object SlayerItemProfitTracker { } if (config.titleWarning) { if (price > config.minimumPriceWarning) { - TitleUtils.sendTitle("§a+ $itemName", 5_000) + TitleUtils.sendTitle("§a+ $itemName", 5.seconds) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt index 9fc4b9c6e..6c3648bcc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt @@ -15,6 +15,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.getLorenzVec import net.minecraft.entity.EntityLivingBase import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.seconds class SlayerQuestWarning { private val config get() = SkyHanniMod.feature.slayer @@ -134,7 +135,7 @@ class SlayerQuestWarning { LorenzUtils.chat("§e[SkyHanni] $chatMessage") if (config.questWarningTitle) { - TitleUtils.sendTitle("§e$titleMessage", 2_000) + TitleUtils.sendTitle("§e$titleMessage", 2.seconds) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt index 371aa5337..7f785cf10 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt @@ -19,6 +19,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeWordsAtEnd import io.github.moulberry.notenoughupdates.util.Constants import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.math.ceil +import kotlin.time.Duration.Companion.seconds class SlayerRngMeterDisplay { private val config get() = SkyHanniMod.feature.slayer.rngMeterDisplay @@ -74,7 +75,7 @@ class SlayerRngMeterDisplay { if (!hasItemSelected) { if (config.warnEmpty) { LorenzUtils.warning("§c[Skyhanni] No Slayer RNG Meter Item selected!") - TitleUtils.sendTitle("§cNo RNG Meter Item!", 3_000) + TitleUtils.sendTitle("§cNo RNG Meter Item!", 3.seconds) } } var blockChat = config.hideChat && hasItemSelected diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt index f0c6e214f..6d93816b7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt @@ -128,8 +128,12 @@ object VampireSlayerFeatures { if (shouldSendSound) playTwinclawsSound() if (shouldSendTitle) - TitleUtils.sendTitle("§6§lTWINCLAWS", (1750 - config.twinclawsDelay), 2.6) - nextClawSend = System.currentTimeMillis() + 5000 + TitleUtils.sendTitle( + "§6§lTWINCLAWS", + (1750 - config.twinclawsDelay).milliseconds, + 2.6 + ) + nextClawSend = System.currentTimeMillis() + 5_000 } } } @@ -179,7 +183,7 @@ object VampireSlayerFeatures { else canUseSteak && configCoopBoss.steakAlert && containCoop if (shouldSendSteakTitle) - TitleUtils.sendTitle("§c§lSTEAK!", 300, 2.6) + TitleUtils.sendTitle("§c§lSTEAK!", 300.milliseconds, 2.6) if (shouldRender) { RenderLivingEntityHelper.setEntityColor(this, color) { isEnabled() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt index c518d1317..723432b9a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt @@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.SoundUtils.playSound import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.seconds class BlazeSlayerFirePitsWarning { private val config get() = SkyHanniMod.feature.slayer @@ -18,7 +19,7 @@ class BlazeSlayerFirePitsWarning { private var lastFirePitsWarning = 0L fun fireFirePits() { - TitleUtils.sendTitle("§cFire Pits!", 2_000) + TitleUtils.sendTitle("§cFire Pits!", 2.seconds) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt index 1264c14dc..dcdadf84a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt @@ -58,7 +58,7 @@ class EndermanSlayerFeatures { if (stack.name == "Beacon" && canSee(LocationUtils.playerEyeLocation(), entity.getLorenzVec())) { flyingBeacons.add(entity) if (beaconConfig.showWarning) - TitleUtils.sendTitle("§4Beacon", 2_000) + TitleUtils.sendTitle("§4Beacon", 2.seconds) logger.log("Added flying beacons at ${entity.getLorenzVec()}") } } |