aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/slayer
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-07 23:37:18 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-07 23:37:18 +0200
commit02ac961b3f1a371302963559e875698de8eb7a1d (patch)
tree6432f510a74cc9381610466442ca023de6498a8a /src/main/java/at/hannibal2/skyhanni/features/slayer
parent8b2bc18775d69d4ab854eed7e3e10e36085043fd (diff)
downloadskyhanni-02ac961b3f1a371302963559e875698de8eb7a1d.tar.gz
skyhanni-02ac961b3f1a371302963559e875698de8eb7a1d.tar.bz2
skyhanni-02ac961b3f1a371302963559e875698de8eb7a1d.zip
replace enum.getEntries() to enum.entries and using .addSelector<Enum>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/slayer')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniBoss.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt12
4 files changed, 16 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniBoss.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniBoss.kt
index 5ed91696f..8c6399dde 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniBoss.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniBoss.kt
@@ -26,7 +26,7 @@ class HighlightSlayerMiniBoss {
if (DamageIndicatorManager.isBoss(entity)) return
val maxHealth = event.maxHealth
- for (bossType in SlayerMiniBossType.values()) {
+ for (bossType in SlayerMiniBossType.entries) {
if (!bossType.clazz.isInstance(entity)) continue
if (bossType.health.any { entity.hasMaxHealth(it, false, maxHealth) }) {
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 cd08bbfdb..581761831 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt
@@ -162,13 +162,15 @@ object SlayerItemProfitTracker {
addAsSingletonList("§e§l$itemLogCategory Profit Tracker")
if (inventoryOpen) {
- addSelector("§7Display Mode: ", DisplayMode.values(),
+ addSelector<DisplayMode>(
+ "§7Display Mode: ",
getName = { type -> type.displayName },
isCurrent = { it == currentDisplayMode },
onChange = {
currentDisplayMode = it
update()
- })
+ }
+ )
}
var profit = 0.0
@@ -265,13 +267,15 @@ object SlayerItemProfitTracker {
addAsSingletonList(Renderable.hoverTips(text, listOf("§7Profit per boss: $profitPrefix$profitPerBossFormat")))
if (inventoryOpen) {
- addSelector("", PriceSource.values(),
+ addSelector<PriceSource>(
+ "",
getName = { type -> type.displayName },
isCurrent = { it.ordinal == config.priceFrom },
onChange = {
config.priceFrom = it.ordinal
update()
- })
+ }
+ )
}
if (inventoryOpen && currentDisplayMode == DisplayMode.CURRENT) {
addAsSingletonList(
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt
index 8c44dbd3b..8319bfb3a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt
@@ -51,7 +51,7 @@ enum class SlayerType(val displayName: String, val clazz: Class<*>) {
}
fun getByDisplayName(text: String): SlayerType? {
- return values().firstOrNull { text.startsWith(it.displayName) }
+ return entries.firstOrNull { text.startsWith(it.displayName) }
}
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
index 632433573..68cd7bd17 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
@@ -63,7 +63,7 @@ class BlazeSlayerDaggerHelper {
checkActiveDagger()
lastNearest = findNearest()
- val first = Dagger.values()[SkyHanniMod.feature.slayer.blazeFirstDagger]
+ val first = Dagger.entries[SkyHanniMod.feature.slayer.blazeFirstDagger]
val second = first.other()
textTopLeft = format(holding, true, first)
@@ -122,7 +122,7 @@ class BlazeSlayerDaggerHelper {
if (lastDaggerCheck + 1_000 > System.currentTimeMillis()) return
lastDaggerCheck = System.currentTimeMillis()
- for (dagger in Dagger.values()) {
+ for (dagger in Dagger.entries) {
if (dagger.updated) continue
val first = dagger.shields[0]
@@ -160,7 +160,7 @@ class BlazeSlayerDaggerHelper {
private fun getDaggerFromStack(stack: ItemStack?): Dagger? {
val itemName = stack?.name ?: ""
- for (dagger in Dagger.values()) {
+ for (dagger in Dagger.entries) {
if (dagger.daggerNames.any { itemName.contains(it) }) {
return dagger
}
@@ -174,9 +174,9 @@ class BlazeSlayerDaggerHelper {
if (!isEnabled()) return
- for (shield in HellionShield.values()) {
+ for (shield in HellionShield.entries) {
if (shield.formattedName + "§r" == event.title) {
- Dagger.values().filter { shield in it.shields }.forEach {
+ Dagger.entries.filter { shield in it.shields }.forEach {
it.shields.forEach { shield -> shield.active = false }
it.updated = true
}
@@ -310,7 +310,7 @@ class BlazeSlayerDaggerHelper {
}
private fun HellionShield.other(): HellionShield {
- for (dagger in BlazeSlayerDaggerHelper.Dagger.values()) {
+ for (dagger in BlazeSlayerDaggerHelper.Dagger.entries) {
if (this in dagger.shields) {
for (shield in dagger.shields) {
if (shield != this) {