chat colors: add color option for player's own name

This commit is contained in:
Robert
2021-04-04 23:56:47 -04:00
committed by GitHub
parent e70a92d977
commit faa1ef6e2f
2 changed files with 24 additions and 3 deletions

View File

@@ -131,13 +131,16 @@ public class ChatMessageManager
case MODCHAT:
{
String sanitizedUsername = Text.removeTags(chatMessage.getName());
boolean isFriend = client.isFriended(sanitizedUsername, true) && !client.getLocalPlayer().getName().equals(sanitizedUsername);
if (isFriend)
if (client.getLocalPlayer().getName().equals(sanitizedUsername))
{
usernameColor = isChatboxTransparent ? chatColorConfig.transparentPlayerUsername() : chatColorConfig.opaquePlayerUsername();
}
else if (client.isFriended(sanitizedUsername, true))
{
usernameColor = isChatboxTransparent ? chatColorConfig.transparentPublicFriendUsernames() : chatColorConfig.opaquePublicFriendUsernames();
}
if (usernameColor == null)
else
{
usernameColor = isChatboxTransparent ? chatColorConfig.transparentUsername() : chatColorConfig.opaqueUsername();
}

View File

@@ -313,6 +313,15 @@ public interface ChatColorConfig extends Config
)
Color opaquePublicFriendUsernames();
@ConfigItem(
position = 28,
keyName = "opaquePlayerUsername",
name = "Your username",
description = "Color of your username",
section = opaqueSection
)
Color opaquePlayerUsername();
@ConfigItem(
position = 51,
keyName = "transparentPublicChat",
@@ -579,4 +588,13 @@ public interface ChatColorConfig extends Config
section = transparentSection
)
Color transparentPublicFriendUsernames();
@ConfigItem(
position = 78,
keyName = "transparentPlayerUsername",
name = "Your username (transparent)",
description = "Color of your username (transparent)",
section = transparentSection
)
Color transparentPlayerUsername();
}