summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/rift
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-11 12:28:07 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-11 12:28:07 +0200
commit8ccfdc9b7d22352c23d4bff5ee240fa71e302262 (patch)
treea11139ca4bdfba81fcc538ea76424fe66ca1b409 /src/main/java/at/hannibal2/skyhanni/features/rift
parent4f9fe89aac7b97741f7079ab1ad5f7051e0fa7f7 (diff)
downloadskyhanni-8ccfdc9b7d22352c23d4bff5ee240fa71e302262.tar.gz
skyhanni-8ccfdc9b7d22352c23d4bff5ee240fa71e302262.tar.bz2
skyhanni-8ccfdc9b7d22352c23d4bff5ee240fa71e302262.zip
code cleanup
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/rift')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt
index d66973cd3..9abad8212 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt
@@ -1,6 +1,5 @@
package at.hannibal2.skyhanni.features.rift.area.mirrorverse
-
import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
@@ -54,16 +53,16 @@ object DanceRoomHelper {
index < size && index == lineIndex -> {
val countdown = countdown?.let { "${color.countdown.formatColor()}$it" } ?: ""
"${now.formatColor()} $format $countdown"
-
}
+
index + 1 < size && index + 1 == lineIndex -> {
"${next.formatColor()} $format"
-
}
+
index + 2 < size && (index + 2..index + config.lineToShow).contains(lineIndex) -> {
"${later.formatColor()} $format"
-
}
+
else -> null
}
}
@@ -73,14 +72,16 @@ object DanceRoomHelper {
private fun String.format() =
split(" ").joinToString(" ") { it.firstLetterUppercase().addColor().replace("&", "ยง") }
- private fun String.addColor() = when (this) {
- "Move" -> config.danceRoomFormatting.color.move
- "Stand" -> config.danceRoomFormatting.color.stand
- "Sneak" -> config.danceRoomFormatting.color.sneak
- "Jump" -> config.danceRoomFormatting.color.jump
- "Punch" -> config.danceRoomFormatting.color.punch
- else -> config.danceRoomFormatting.color.fallback
- } + this
+ private fun String.addColor() = with(config.danceRoomFormatting.color) {
+ when (this@addColor) {
+ "Move" -> move
+ "Stand" -> stand
+ "Sneak" -> sneak
+ "Jump" -> jump
+ "Punch" -> punch
+ else -> fallback
+ } + this
+ }
@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {