Fixed only the last friend in your friends list being highlighted in chat.

This commit is contained in:
Sorzon 2020-05-11 19:29:33 +02:00
parent 8c8a0b753c
commit 88fe1a8333
1 changed files with 3 additions and 3 deletions

View File

@ -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
})