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;
}
Should be easy enough:
player.getDisplayName()returns aText, so we can JSON serialize that and change the player list entry format to: