KyoriPowered / adventure

A user-interface library, formerly known as text, for Minecraft: Java Edition
https://docs.advntr.dev/
MIT License
679 stars 104 forks source link

Legacy serializer doesn't apply color for empty content #1030

Open WhatCats opened 5 months ago

WhatCats commented 5 months ago

Code

Component component = Component.text().color(NamedTextColor.GRAY).build();
Loggers.debug(
    "%s -> %s",
    GsonComponentSerializer.gson().serialize(component),
    LegacyComponentSerializer.legacyAmpersand().serialize(component)
);

Ouput

{"color":"gray","text":""} ->

Expected Output

{"color":"gray","text":""} -> &7

Reason

If you are using Components for prefix's in 1.8 for example you might have this condition where you want a color but no text.