From 02ac961b3f1a371302963559e875698de8eb7a1d Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 7 Aug 2023 23:37:18 +0200 Subject: replace enum.getEntries() to enum.entries and using .addSelector --- .../at/hannibal2/skyhanni/features/misc/FrozenTreasureTracker.kt | 6 +++--- .../at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt | 6 +++--- .../skyhanni/features/misc/discordrpc/DiscordRPCManager.kt | 2 +- .../at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt | 2 +- .../hannibal2/skyhanni/features/misc/tiarelay/TiaRelayWaypoints.kt | 4 ++-- .../at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt | 4 ++-- .../java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/FrozenTreasureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/FrozenTreasureTracker.kt index 664c0a42d..8350a637e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/FrozenTreasureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/FrozenTreasureTracker.kt @@ -89,7 +89,7 @@ class FrozenTreasureTracker { if (config.hideMessages) event.blockedReason = "frozen treasure tracker" } - for (treasure in FrozenTreasure.values()) { + for (treasure in FrozenTreasure.entries) { if ("FROZEN TREASURE! You found ${treasure.displayName.removeColor()}!".toRegex().matches(message)) { treasuresMined += 1 val old = treasureCount[treasure] ?: 0 @@ -122,7 +122,7 @@ class FrozenTreasureTracker { addAsSingletonList("§8${formatNumber(compactProcs)} Compact Procs") addAsSingletonList("") - for (treasure in FrozenTreasure.values()) { + for (treasure in FrozenTreasure.entries) { val count = (treasureCount[treasure] ?: 0) * if (config.showAsDrops) treasure.defaultAmount else 1 addAsSingletonList("§b${formatNumber(count)} ${treasure.displayName}") } @@ -147,7 +147,7 @@ class FrozenTreasureTracker { private fun calculateIce() { estimatedIce = 0 estimatedIce += compactProcs * 160 - for (treasure in FrozenTreasure.values()) { + for (treasure in FrozenTreasure.entries) { val amount = treasureCount[treasure] ?: 0 estimatedIce += amount * treasure.defaultAmount * treasure.iceMultiplier } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt index 6477d7c36..d6e429fa0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt @@ -145,7 +145,7 @@ class NonGodPotEffectDisplay { for (stack in event.inventoryItems.values) { val name = stack.name ?: continue - for (effect in NonGodPotEffect.values()) { + for (effect in NonGodPotEffect.entries) { if (name != effect.displayName) continue for (line in stack.getLore()) { if (line.contains("Remaining") && @@ -182,7 +182,7 @@ class NonGodPotEffectDisplay { var effectsCount = 0 for (line in lines) { - for (effect in NonGodPotEffect.values()) { + for (effect in NonGodPotEffect.entries) { if (line.startsWith(effect.displayName)) { try { val duration = TimeUtils.getMillis(line.split("§f")[1]) @@ -221,7 +221,7 @@ class NonGodPotEffectDisplay { for (element in effects) { val effectJson = element.asJsonObject val name = effectJson["effect"].asString - val effect = NonGodPotEffect.values().find { it.apiName == name } ?: continue + val effect = NonGodPotEffect.entries.find { it.apiName == name } ?: continue val time = effectJson["ticks_remaining"].asLong / 20 val newValue = System.currentTimeMillis() + time * 1000 diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt index 82e40ced3..615559360 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt @@ -146,7 +146,7 @@ object DiscordRPCManager : IPCListener { } } - private fun getStatusByConfigId(id: Int) = DiscordStatus.values().getOrElse(id) { DiscordStatus.NONE } + private fun getStatusByConfigId(id: Int) = DiscordStatus.entries.getOrElse(id) { DiscordStatus.NONE } private fun isEnabled() = config.enabled.get() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt index e2a25b219..5b4102a15 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt @@ -255,7 +255,7 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier?) else if (milestoneResult != "Not farming!") milestoneResult else if (stackingResult != "") stackingResult else { - val statusNoAuto = DiscordStatus.values().toMutableList() + val statusNoAuto = entries.toMutableList() statusNoAuto.remove(AUTO) statusNoAuto[SkyHanniMod.feature.misc.discordRPC.auto.get()].getDisplayString() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayWaypoints.kt index 10c6612bd..7bfc45ae9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayWaypoints.kt @@ -22,7 +22,7 @@ class TiaRelayWaypoints { if (!SkyHanniMod.feature.misc.tiaRelayNextWaypoint) return val message = event.message - for (relay in Relay.values()) { + for (relay in Relay.entries) { if (relay.chatMessage == message) { waypoint = relay.waypoint waypointName = relay.relayName @@ -42,7 +42,7 @@ class TiaRelayWaypoints { if (!LorenzUtils.inSkyBlock) return if (SkyHanniMod.feature.misc.tiaRelayAllWaypoints) { - for (relay in Relay.values()) { + for (relay in Relay.entries) { if (relay.island == LorenzUtils.skyBlockIsland) { event.drawWaypointFilled(relay.waypoint, LorenzColor.LIGHT_PURPLE.toColor()) event.drawDynamicText(relay.waypoint, "§d" + relay.relayName, 1.5) 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 61f6fedda..11c0504d8 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 @@ -133,13 +133,13 @@ class TrevorFeatures { active = true } - CurrentMobArea.values().firstOrNull { it.location == formattedLine }?.let { + CurrentMobArea.entries.firstOrNull { it.location == formattedLine }?.let { TrevorSolver.mobLocation = it found = true } locationPattern.matchMatcher(formattedLine) { val zone = group("zone") - TrevorSolver.mobLocation = CurrentMobArea.values().firstOrNull { it.location == zone } + TrevorSolver.mobLocation = CurrentMobArea.entries.firstOrNull { it.location == zone } ?: CurrentMobArea.NONE found = true } 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 6ba60604c..0ef03688e 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 @@ -52,7 +52,7 @@ object TrevorSolver { if (entity is EntityOtherPlayerMP) continue val name = entity.name val entityHealth = if (entity is EntityLivingBase) entity.baseMaxHealth else 0 - currentMob = TrevorMobs.values().firstOrNull { it.mobName.contains(name) } + currentMob = TrevorMobs.entries.firstOrNull { it.mobName.contains(name) } if (currentMob == TrevorMobs.CHICKEN) { if (entity is EntityChicken) { if (entity.hasMaxHealth(20_000)) { -- cgit