Fixing problems with friends. (#811)

This commit is contained in:
Dominika 2020-05-15 14:34:34 -04:00 committed by GitHub
commit efef1c7621
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -280,10 +280,9 @@ public class KamiGUI extends GUI {
Frame finalFrame = frame;
friends.addTickListener(() -> {
friends.setText("");
friends.setWidth(50);
if (!finalFrame.isMinimized()) {
Friends.friends.getValue().forEach(friend -> friends.addLine(friend.getUsername()));
} else {
friends.setWidth(50);
}
});

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(RegexOption.IGNORE_CASE), colour() + bold() + friend.username + TextFormatting.RESET.toString()) })
val message = TextComponentString(converted)
event.message = message
})