diff options
author | Empa <42304516+ItsEmpa@users.noreply.github.com> | 2024-05-30 08:25:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-30 08:25:13 +0200 |
commit | bd8c3ac5b05c60e36969406de3f6d9df7601161c (patch) | |
tree | 94e50bcb65ba5025882a8cd5535186e877fa1c4a /src | |
parent | 29ddd9d05a59c9540869c0f96648cda8ad9364df (diff) | |
download | skyhanni-bd8c3ac5b05c60e36969406de3f6d9df7601161c.tar.gz skyhanni-bd8c3ac5b05c60e36969406de3f6d9df7601161c.tar.bz2 skyhanni-bd8c3ac5b05c60e36969406de3f6d9df7601161c.zip |
Backend: Remove LorenzUtils.runDelayed (#1778)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src')
3 files changed, 4 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt index a60ebc7ff..7bdf46dd0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt @@ -10,11 +10,11 @@ import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ConditionalUtils +import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.NumberUtil.formatLong @@ -91,7 +91,7 @@ class GardenLevelDisplay { if (!config.overflowChat) return val newLevel = GardenAPI.getGardenLevel() if (newLevel != oldLevel + 1 || newLevel <= 15) return - LorenzUtils.runDelayed(50.milliseconds) { + DelayedRun.runDelayed(50.milliseconds) { // TODO utils function that is shared with Crop Milestone Display ChatUtils.clickableChat( " \n§b§lGARDEN LEVEL UP §8$oldLevel ➜ §b$newLevel\n" + diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/MiningNotifications.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/MiningNotifications.kt index 370fd1815..e3168e4b1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/MiningNotifications.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/MiningNotifications.kt @@ -11,9 +11,9 @@ import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.utils.ConditionalUtils +import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland -import at.hannibal2.skyhanni.utils.LorenzUtils.runDelayed import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.PrimitiveItemStack.Companion.makePrimitiveStack import at.hannibal2.skyhanni.utils.RegexUtils.matches @@ -83,7 +83,7 @@ object MiningNotifications { sendNotification(MiningNotificationList.COLD) } if (IslandType.MINESHAFT.isInIsland() && config.getAscensionRope && config.coldAmount == event.cold) { - runDelayed(0.5.seconds) { + DelayedRun.runDelayed(0.5.seconds) { GetFromSackAPI.getFromChatMessageSackItems(ASCENSION_ROPE) } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 2a351a7d9..0dc0047a5 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -34,8 +34,6 @@ import java.text.DecimalFormat import java.text.SimpleDateFormat import java.time.LocalDate import java.time.Month -import java.util.Timer -import java.util.TimerTask import java.util.regex.Matcher import kotlin.time.Duration import kotlin.time.Duration.Companion.seconds @@ -309,14 +307,6 @@ object LorenzUtils { fun Int.ignoreDerpy() = if (isDerpy) this * 2 else this - fun runDelayed(duration: Duration, runnable: () -> Unit) { - Timer().schedule(object : TimerTask() { - override fun run() { - runnable() - } - }, duration.inWholeMilliseconds) - } - val JsonPrimitive.asIntOrNull get() = takeIf { it.isNumber }?.asInt fun sendTitle(text: String, duration: Duration, height: Double = 1.8, fontSize: Float = 4f) { |