3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-08 09:10:10 +01:00

Fix legacy component text wrapping

Fixes #2821
Dieser Commit ist enthalten in:
Nassim Jahnke 2022-02-22 10:10:51 +01:00
Ursprung 46bd5814e3
Commit 28bd50a105
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -30,14 +30,11 @@ public final class ChatRewriter {
public static final GsonComponentSerializer HOVER_GSON_SERIALIZER = GsonComponentSerializer.builder().emitLegacyHoverEvent().legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.get()).build();
public static String legacyTextToJsonString(String message, boolean itemData) {
Component component = Component.text(builder -> {
if (itemData) {
builder.decoration(TextDecoration.ITALIC, false);
}
// Not used for chat messages, so no need for url extraction
builder.append(LegacyComponentSerializer.legacySection().deserialize(message));
});
// Not used for chat messages, so no need for url extraction
Component component = LegacyComponentSerializer.legacySection().deserialize(message);
if (itemData) {
component = Component.text().decoration(TextDecoration.ITALIC, false).append(component).build();
}
return GsonComponentSerializer.gson().serialize(component);
}