summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/dungeon
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-06-13 22:21:50 +0200
committerGitHub <noreply@github.com>2024-06-13 22:21:50 +0200
commit529639fdd0683066eadffe93473a300a2177c008 (patch)
treed89cd9aa2c04b4a8a839b9c3b1a56d2058fa7956 /src/main/java/at/hannibal2/skyhanni/features/dungeon
parent151865bca064421d48ec19279b759134fc428443 (diff)
downloadskyhanni-529639fdd0683066eadffe93473a300a2177c008.tar.gz
skyhanni-529639fdd0683066eadffe93473a300a2177c008.tar.bz2
skyhanni-529639fdd0683066eadffe93473a300a2177c008.zip
Backend: for each (#1725)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/dungeon')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonsRaceGuide.kt18
3 files changed, 16 insertions, 21 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt
index 801b4f800..ff6c277bb 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt
@@ -102,9 +102,7 @@ object CroesusChestTracker {
pageSetup(event)
if (croesusEmpty) {
- croesusChests?.forEach {
- it.setValuesNull()
- }
+ croesusChests?.forEach { it.setValuesNull() }
return
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt
index 8b852f1cc..e79abbe7c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt
@@ -171,10 +171,10 @@ object DungeonAPI {
it.contains(LorenzUtils.getPlayerName())
}?.removeColor() ?: ""
- DungeonClass.entries.forEach {
- if (playerTeam.contains("(${it.scoreboardName} ")) {
+ for (dungeonClass in DungeonClass.entries) {
+ if (playerTeam.contains("(${dungeonClass.scoreboardName} ")) {
val level = playerTeam.split(" ").last().trimEnd(')').romanToDecimalIfNecessary()
- playerClass = it
+ playerClass = dungeonClass
playerClassLevel = level
}
}
@@ -184,15 +184,14 @@ object DungeonAPI {
@SubscribeEvent
fun onTabUpdate(event: TablistFooterUpdateEvent) {
if (!inDungeon()) return
- val tabList = event.footer.split("\n")
- tabList.forEach {
- if (noBlessingPattern.matches(it)) {
+ for (line in event.footer.split("\n")) {
+ if (noBlessingPattern.matches(line)) {
DungeonBlessings.reset()
return
}
- val matcher = blessingPattern.matcher(it)
+ val matcher = blessingPattern.matcher(line)
if (matcher.find()) {
- val type = matcher.group("type") ?: return@forEach
+ val type = matcher.group("type") ?: continue
val amount = matcher.group("amount").romanToDecimalIfNecessary()
if (DungeonBlessings.valueOf(type.uppercase()).power != amount) {
DungeonBlessings.valueOf(type.uppercase()).power = amount
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonsRaceGuide.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonsRaceGuide.kt
index 1a543749d..34d0621cd 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonsRaceGuide.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonsRaceGuide.kt
@@ -39,9 +39,9 @@ object DungeonsRaceGuide {
@SubscribeEvent
fun onRepoReload(event: RepositoryReloadEvent) {
val data = event.getConstant<DungeonHubRacesJson>("DungeonHubRaces")
- data.data.forEach {
- val nothingNoReturn = it.value["nothing:no_return"]
- parkourHelpers[it.key] = ParkourHelper(
+ for ((key, map) in data.data) {
+ val nothingNoReturn = map["nothing:no_return"]
+ parkourHelpers[key] = ParkourHelper(
nothingNoReturn?.locations ?: listOf(),
nothingNoReturn?.shortCuts ?: listOf(),
platformSize = 1.0,
@@ -67,17 +67,15 @@ object DungeonsRaceGuide {
currentRace = group("race").replace(" ", "_").lowercase()
}
if (currentRace == null) {
- parkourHelpers.forEach {
- it.value.reset()
- }
+ parkourHelpers.forEach { it.value.reset() }
}
}
private fun updateConfig() {
- parkourHelpers.forEach {
- it.value.rainbowColor = config.rainbowColor.get()
- it.value.monochromeColor = config.monochromeColor.get().toChromaColor()
- it.value.lookAhead = config.lookAhead.get() + 1
+ parkourHelpers.values.forEach {
+ it.rainbowColor = config.rainbowColor.get()
+ it.monochromeColor = config.monochromeColor.get().toChromaColor()
+ it.lookAhead = config.lookAhead.get() + 1
}
}