diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-04-05 18:35:22 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-04-05 18:35:22 +0200 |
commit | 6f76c464825de167b2c475c6a635c29db694924e (patch) | |
tree | 5be623000af0c6546407ff5fdc70dcbcac070239 /src/main/java/at | |
parent | bd34b28c14940a0d21a08057e944c7d55d91a1fd (diff) | |
download | skyhanni-6f76c464825de167b2c475c6a635c29db694924e.tar.gz skyhanni-6f76c464825de167b2c475c6a635c29db694924e.tar.bz2 skyhanni-6f76c464825de167b2c475c6a635c29db694924e.zip |
code cleanup
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt index a18dbf502..0bd1e6866 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt @@ -16,7 +16,6 @@ class ScoreboardData { private val minecraftColorCodesPattern = "(?i)[0-9a-fkmolnr]".toPattern() - // TODO USE SH-REPO private val splitIcons = listOf( "\uD83C\uDF6B", @@ -45,17 +44,11 @@ class ScoreboardData { var end = split[1] // get last color code in start val lastColorIndex = start.lastIndexOf('ยง') - val lastColor = when { - lastColorIndex != -1 - && lastColorIndex + 1 < start.length - && (minecraftColorCodesPattern.matches( start[lastColorIndex + 1].toString())) - -> start.substring( - lastColorIndex, - lastColorIndex + 2 - ) - - else -> "" - } + val lastColor = if (lastColorIndex != -1 + && lastColorIndex + 1 < start.length + && (minecraftColorCodesPattern.matches(start[lastColorIndex + 1].toString())) + ) start.substring(lastColorIndex, lastColorIndex + 2) + else "" // remove first color code from end, when it is the same as the last color code in start end = end.removePrefix(lastColor) |