chat message manager: add default color for friendschatnotification chat type
This allows the config value for friends chat notifications to just default to null, allowing plugins to detect whether or not we want to override the default color for friends chat notification messages.
This commit is contained in:
@@ -231,6 +231,7 @@ public class ChatMessageManager
|
|||||||
case OBJECT_EXAMINE:
|
case OBJECT_EXAMINE:
|
||||||
case NPC_EXAMINE:
|
case NPC_EXAMINE:
|
||||||
case CONSOLE:
|
case CONSOLE:
|
||||||
|
case FRIENDSCHATNOTIFICATION:
|
||||||
return JagexColors.CHAT_GAME_EXAMINE_TEXT_OPAQUE_BACKGROUND;
|
return JagexColors.CHAT_GAME_EXAMINE_TEXT_OPAQUE_BACKGROUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -251,6 +252,7 @@ public class ChatMessageManager
|
|||||||
case OBJECT_EXAMINE:
|
case OBJECT_EXAMINE:
|
||||||
case NPC_EXAMINE:
|
case NPC_EXAMINE:
|
||||||
case CONSOLE:
|
case CONSOLE:
|
||||||
|
case FRIENDSCHATNOTIFICATION:
|
||||||
return JagexColors.CHAT_GAME_EXAMINE_TEXT_TRANSPARENT_BACKGROUND;
|
return JagexColors.CHAT_GAME_EXAMINE_TEXT_TRANSPARENT_BACKGROUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
package net.runelite.client.config;
|
package net.runelite.client.config;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import net.runelite.client.ui.JagexColors;
|
|
||||||
|
|
||||||
@ConfigGroup("textrecolor")
|
@ConfigGroup("textrecolor")
|
||||||
public interface ChatColorConfig extends Config
|
public interface ChatColorConfig extends Config
|
||||||
@@ -111,15 +110,12 @@ public interface ChatColorConfig extends Config
|
|||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 7,
|
position = 7,
|
||||||
keyName = "opaqueClanChatInfo",
|
keyName = "opaqueFriendsChatInfo",
|
||||||
name = "Friends chat info",
|
name = "Friends chat info",
|
||||||
description = "Friends Chat Information (eg. when joining a channel)",
|
description = "Friends Chat Information (eg. when joining a channel)",
|
||||||
section = opaqueSection
|
section = opaqueSection
|
||||||
)
|
)
|
||||||
default Color opaqueFriendsChatInfo()
|
Color opaqueFriendsChatInfo();
|
||||||
{
|
|
||||||
return JagexColors.CHAT_GAME_EXAMINE_TEXT_OPAQUE_BACKGROUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 8,
|
position = 8,
|
||||||
@@ -387,15 +383,12 @@ public interface ChatColorConfig extends Config
|
|||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 57,
|
position = 57,
|
||||||
keyName = "transparentClanChatInfo",
|
keyName = "transparentFriendsChatInfo",
|
||||||
name = "Friends chat info (transparent)",
|
name = "Friends chat info (transparent)",
|
||||||
description = "Friends chat information (eg. when joining a channel) (transparent)",
|
description = "Friends chat information (eg. when joining a channel) (transparent)",
|
||||||
section = transparentSection
|
section = transparentSection
|
||||||
)
|
)
|
||||||
default Color transparentFriendsChatInfo()
|
Color transparentFriendsChatInfo();
|
||||||
{
|
|
||||||
return JagexColors.CHAT_GAME_EXAMINE_TEXT_TRANSPARENT_BACKGROUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 58,
|
position = 58,
|
||||||
|
|||||||
@@ -145,4 +145,41 @@ public class ChatMessageManagerTest
|
|||||||
|
|
||||||
verify(messageNode).setName("<col=b20000>" + friendName + "</col>");
|
verify(messageNode).setName("<col=b20000>" + friendName + "</col>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDefaultFriendsChatInfoColors()
|
||||||
|
{
|
||||||
|
// no color is configured for opaqueFriendsChatInfo
|
||||||
|
when(chatColorConfig.opaqueFriendsChatInfoHighlight()).thenReturn(Color.RED);
|
||||||
|
|
||||||
|
// rebuild color cache
|
||||||
|
ConfigChanged configChanged = new ConfigChanged();
|
||||||
|
configChanged.setGroup("textrecolor");
|
||||||
|
chatMessageManager.onConfigChanged(configChanged);
|
||||||
|
|
||||||
|
String chatMessage = new ChatMessageBuilder()
|
||||||
|
.append(ChatColorType.NORMAL)
|
||||||
|
.append("Total points: ")
|
||||||
|
.append(ChatColorType.HIGHLIGHT)
|
||||||
|
.append("42")
|
||||||
|
.append(ChatColorType.NORMAL)
|
||||||
|
.append(", Personal points: ")
|
||||||
|
.append(ChatColorType.HIGHLIGHT)
|
||||||
|
.append("43")
|
||||||
|
.append(ChatColorType.NORMAL)
|
||||||
|
.append(" (")
|
||||||
|
.append(ChatColorType.HIGHLIGHT)
|
||||||
|
.append("44")
|
||||||
|
.append(ChatColorType.NORMAL)
|
||||||
|
.append("%)")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
MessageNode messageNode = mock(MessageNode.class);
|
||||||
|
when(messageNode.getType()).thenReturn(ChatMessageType.FRIENDSCHATNOTIFICATION);
|
||||||
|
when(messageNode.getRuneLiteFormatMessage()).thenReturn(chatMessage);
|
||||||
|
|
||||||
|
chatMessageManager.update(messageNode);
|
||||||
|
|
||||||
|
verify(messageNode).setValue("<col=000000>Total points: <col=ff0000>42<col=000000>, Personal points: <col=ff0000>43<col=000000> (<col=ff0000>44<col=000000>%)");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user