chat notifications: restore normal color after own name highlight
This commit is contained in:
@@ -245,7 +245,7 @@ public class ChatNotificationsPlugin extends Plugin
|
||||
{
|
||||
final int start = matcher.start();
|
||||
final String username = client.getLocalPlayer().getName();
|
||||
final String closeColor = MoreObjects.firstNonNull(getLastColor(message.substring(0, start)), "</col>");
|
||||
final String closeColor = MoreObjects.firstNonNull(getLastColor(message.substring(0, start)), "<col" + ChatColorType.NORMAL + '>');
|
||||
final String replacement = "<col" + ChatColorType.HIGHLIGHT.name() + "><u>" + username + "</u>" + closeColor;
|
||||
messageNode.setValue(matcher.replaceAll(replacement));
|
||||
update = true;
|
||||
|
||||
@@ -307,7 +307,7 @@ public class ChatNotificationsPluginTest
|
||||
ChatMessage chatMessage = new ChatMessage(messageNode, ChatMessageType.GAMEMESSAGE, "", "", "", 0);
|
||||
chatNotificationsPlugin.onChatMessage(chatMessage);
|
||||
|
||||
verify(messageNode).setValue("<colHIGHLIGHT><u>Logic Knot</u></col> received a drop: Adamant longsword");
|
||||
verify(messageNode).setValue("<colHIGHLIGHT><u>Logic Knot</u><colNORMAL> received a drop: Adamant longsword");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user