Hello, this is both a feature request and a workaround if this isn't something relevant for BetterChat to implement. Probably could've done this through the API methods with a custom plugins, but since it was pretty simple, I just wrote it straight into BetterChat's code. Though this means I need to keep track of updates to re-implement the workaround everytime BetterChat updates, I find this is a good tradeoff for now.

Context
Say I have two groups:
- `bc.username.red` which sets the username color to red and message color to white (Priority 0)
- `bc.message.green` which sets the username color to white and message color to green (Priority 1)
- `bc.message.blue` which sets the username color to white and message color to blue (Priority 2)
Currently, if a user has these 3 groups, their username will be red and the message color will be green, because BetterChat uses the primary group to configure both of these components. What I want is to have the username red and the message green (not blue, because green has higher priority).

Workaround
For now, I edited BetterChat to not use the primary group's Username and Message settings, but rather look for other groups that don't use white or #ffffff as color. Here's how to implement it:

  1. Add the following methods over the `PrepareMessage` method
                private static UsernameSettings GetUserUsernameSettings(IPlayer player)
                {
                    List<ChatGroup> groups = GetUserGroups(player);
                    groups.Sort((a, b) => a.Priority.CompareTo(b.Priority));
    
                    foreach (var group in groups)
                    {
                        var color = group.Username.Color;
                        if (!string.IsNullOrEmpty(color) && color.ToLower() != "white" && color.ToLower() != "#ffffff")
                            return group.Username;
                    }
                    
                    return null;
                }
    
                private static MessageSettings GetUserMessageSettings(IPlayer player)
                {
                    List<ChatGroup> groups = GetUserGroups(player);
                    groups.Sort((a, b) => a.Priority.CompareTo(b.Priority));
    
                    foreach (var group in groups)
                    {
                        var color = group.Message.Color;
                        if (!string.IsNullOrEmpty(color) && color.ToLower() != "white" && color.ToLower() != "#ffffff")
                            return group.Message;
                    }
    
                    return null;
                }​
  2. Change the return of `PrepareMessage` to use these new methods instead of just the primary group
                    return new BetterChatMessage
                    {
                        Player = player,
                        Username = StripRichText(player.Name),
                        Message = StripRichText(message),
                        Titles = titles,
                        PrimaryGroup = primary.GroupName,
                        UsernameSettings = GetUserUsernameSettings(player) ?? primary.Username, // This line changed
                        MessageSettings = GetUserMessageSettings(player) ?? primary.Message,    // This line changed
                        FormatSettings = primary.Format
                    };​

     

Just like any other code edits to other plugins, make sure to re-implement this everytime you update BetterChat, unless this becomes a permanent feature!