mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 10:05:12 +01:00
parent
46bd5814e3
commit
28bd50a105
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user