From 6f76c464825de167b2c475c6a635c29db694924e Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 5 Apr 2024 18:35:22 +0200 Subject: code cleanup --- .../java/at/hannibal2/skyhanni/data/ScoreboardData.kt | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/data') 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) -- cgit