From 37f9c2fd312097ca539afacd6d04a24310dcd731 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Fri, 8 Mar 2024 11:42:17 +1100 Subject: fix chat symbols showing twice (#1119) --- .../java/at/hannibal2/skyhanni/features/misc/PlayerChatSymbols.kt | 2 +- src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PlayerChatSymbols.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PlayerChatSymbols.kt index 9492df47b..73cb02b5a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PlayerChatSymbols.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PlayerChatSymbols.kt @@ -31,7 +31,7 @@ class PlayerChatSymbols { ) private val symbolPattern by patternGroup.pattern( "symbol", - "((?:§\\w)+\\S)" + "(?:§.)+(\\S)" ) @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt index a8ab6e6cd..f0456304e 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt @@ -249,8 +249,9 @@ object StringUtils { modifyFirstChatComponent(chatComponent) { component -> if (component is ChatComponentText) { component as AccessorChatComponentText - if (component.text_skyhanni().contains(toReplace)) { - component.setText_skyhanni(component.text_skyhanni().replace(toReplace, replacement)) + val componentText = component.text_skyhanni() + if (componentText.contains(toReplace)) { + component.setText_skyhanni(componentText.replace(toReplace, replacement)) return@modifyFirstChatComponent true } return@modifyFirstChatComponent false -- cgit