legacy <-> json changes
This commit is contained in:
@@ -58,6 +58,13 @@ public final class StringUtils {
|
||||
.hexColors()
|
||||
.build();
|
||||
|
||||
/**
|
||||
* GSON serializer.
|
||||
*/
|
||||
private static final GsonComponentSerializer GSON_COMPONENT_SERIALIZER = GsonComponentSerializer.builder()
|
||||
.emitLegacyHoverEvent()
|
||||
.build();
|
||||
|
||||
/**
|
||||
* Color map.
|
||||
*/
|
||||
@@ -415,7 +422,7 @@ public final class StringUtils {
|
||||
if (legacy == null) {
|
||||
processed = "";
|
||||
}
|
||||
return GsonComponentSerializer.gson().serialize(
|
||||
return GSON_COMPONENT_SERIALIZER.serialize(
|
||||
Component.empty().decoration(TextDecoration.ITALIC, false).append(
|
||||
LEGACY_COMPONENT_SERIALIZER.deserialize(processed)
|
||||
)
|
||||
@@ -431,7 +438,7 @@ public final class StringUtils {
|
||||
@NotNull
|
||||
public static String jsonToLegacy(@NotNull final String json) {
|
||||
return LEGACY_COMPONENT_SERIALIZER.serialize(
|
||||
GsonComponentSerializer.gson().deserialize(json)
|
||||
GSON_COMPONENT_SERIALIZER.deserialize(json)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user