From 4bb1419b90e424ac824042188f67a371a5c276da Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Mon, 19 Feb 2024 23:07:07 +1100 Subject: Fixed tablist footer being uncoloured. #1020 --- .../hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt | 4 ++-- src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt index 659d49e20..07473f9d9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt @@ -4,8 +4,8 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.mixins.transformers.AccessorGuiPlayerTabOverlay import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.StringUtils.removeResets +import at.hannibal2.skyhanni.utils.StringUtils.removeSFormattingCode import at.hannibal2.skyhanni.utils.StringUtils.trimWhiteSpaceAndResets import at.hannibal2.skyhanni.utils.TabListData import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern @@ -107,7 +107,7 @@ object TabListReader { val column = TabColumn("§2§lOther") - var footer = tabList.footer_skyhanni.formattedText.removeColor() + var footer = tabList.footer_skyhanni.formattedText.removeSFormattingCode() var matcher = godPotPattern.matcher(tabList.footer_skyhanni.unformattedText) if (matcher.find()) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt index 001315baf..192073111 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt @@ -18,11 +18,13 @@ object StringUtils { private val whiteSpaceResetPattern = "^(?:\\s|§r)*|(?:\\s|§r)*$".toPattern() private val whiteSpacePattern = "^\\s*|\\s*$".toPattern() private val resetPattern = "(?i)§R".toPattern() + private val sFormattingPattern = "(?i)§S".toPattern() private val stringColourPattern = "§[0123456789abcdef].*".toPattern() fun String.trimWhiteSpaceAndResets(): String = whiteSpaceResetPattern.matcher(this).replaceAll("") fun String.trimWhiteSpace(): String = whiteSpacePattern.matcher(this).replaceAll("") fun String.removeResets(): String = resetPattern.matcher(this).replaceAll("") + fun String.removeSFormattingCode(): String = sFormattingPattern.matcher(this).replaceAll("") fun String.firstLetterUppercase(): String { if (isEmpty()) return this -- cgit