Skip to content

Display colors for player names in player list #143

@danthedaniel

Description

@danthedaniel

Should be easy enough:

networkHandler
    .getPlayerList()
    .forEach(player -> {
        GameProfile profile = player.getProfile(); // Contains UUID and name
        String playerId = profile.getId().toString();
        String playerName = profile.getName();
        String playerDisplayName = player.getDisplayName() != null
            ? player.getDisplayName().getString()
            : playerName;

        // ...
    });

player.getDisplayName() returns a Text, so we can JSON serialize that and change the player list entry format to:

@Data
@Builder
public class PlayerListInfoEntry {

    private String playerId;
    private String playerName;
    private JsonObject playerDisplayName;
    private String playerTextureUrl;
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions