From 88fe1a8333ca9facb2a9e2a9099e14959182dc4e Mon Sep 17 00:00:00 2001 From: Sorzon <64833512+Sorzon@users.noreply.github.com> Date: Mon, 11 May 2020 19:29:33 +0200 Subject: [PATCH] Fixed only the last friend in your friends list being highlighted in chat. --- .../kami/module/modules/chat/FriendHighlight.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/chat/FriendHighlight.kt b/src/main/java/me/zeroeightsix/kami/module/modules/chat/FriendHighlight.kt index 23998351d..4d6176633 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/chat/FriendHighlight.kt +++ b/src/main/java/me/zeroeightsix/kami/module/modules/chat/FriendHighlight.kt @@ -36,9 +36,9 @@ class FriendHighlight : Module() { @EventHandler var listener = Listener(EventHook { event: ClientChatReceivedEvent -> if (mc.player == null || noFriendsCheck()) return@EventHook - val converted = arrayOf("") - Friends.friends.value.forEach(Consumer { friend: Friend -> converted[0] = event.message.formattedText.replace("(?i)" + friend.username.toRegex(), colour() + bold() + friend.username + TextFormatting.RESET.toString()) }) - val message = TextComponentString(converted[0]) + var converted = event.message.formattedText + Friends.friends.value.forEach(Consumer { friend: Friend -> converted = converted.replace(friend.username.toRegex(), colour() + bold() + friend.username + TextFormatting.RESET.toString()) }) + val message = TextComponentString(converted) event.message = message })