From 7149f4ef911349637c3a06362588cf2398c34ed7 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 1 May 2023 20:18:15 +0200 Subject: Fixed private message with one word gets blue colored because of player rank hider --- .../skyhanni/features/chat/playerchat/PlayerChatModifier.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt index 15eff6a85..a8b4d808c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt @@ -13,8 +13,8 @@ class PlayerChatModifier { private val patterns = mutableListOf() init { - patterns.add("§(?:a|b|6)\\[(?:VIP|MVP)(?:(?:§.|\\+)*)](?: {1,2})(?:§[7ab6])?(\\w{2,16})".toRegex()) // ranked player everywhere - patterns.add("§(?:7|a|b|6)((?:\\w){2,16})§r(?!§7x)".toRegex()) // nons in notification message + patterns.add("§[ab6]\\[(?:VIP|MVP)(?:(?:§.|\\+)*)](?: {1,2})(?:§[7ab6])?(\\w{2,16})".toRegex()) // ranked player with prefix everywhere + patterns.add("§[7ab6]((?:\\w){2,16})§r(?!§7x)(?!\$)".toRegex()) // all players without rank prefix in notification messages patterns.add("(?:§7 )?§7((?:\\w){2,16})§7§r".toRegex()) // nons user chat } @@ -36,7 +36,6 @@ class PlayerChatModifier { val newText = cutMessage(original) if (original == newText) return - val text = ChatComponentText(newText) if (size == 1) { val chatStyle = foundCommands[0].chatStyle @@ -73,8 +72,8 @@ class PlayerChatModifier { for (pattern in patterns) { string = string.replace(pattern, "§b$1") } - string = string.replace("§(?:7|a|b|6)((?:\\w+){2,16})'s", "§b$1's") - string = string.replace("§(?:7|a|b|6)((?:\\w+){2,16}) (§.)", "§b$1 $2") + string = string.replace("§[7ab6]((?:\\w+){2,16})'s", "§b$1's") + string = string.replace("§[7ab6]((?:\\w+){2,16}) (§.)", "§b$1 $2") // TODO remove workaround if (!DungeonMilestonesDisplay.isMilestoneMessage(input)) { -- cgit