Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 16:12:42 +01:00
Catch tag to json conversion exceptions
Dieser Commit ist enthalten in:
Ursprung
bae3d8ec8a
Commit
7b4d544e85
@ -53,8 +53,13 @@ public final class ComponentUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static @Nullable JsonElement tagToJson(@Nullable final Tag tag) {
|
public static @Nullable JsonElement tagToJson(@Nullable final Tag tag) {
|
||||||
final ATextComponent component = TextComponentCodec.V1_20_3.deserializeNbtTree(tag);
|
try {
|
||||||
return component != null ? SerializerVersion.V1_19_4.toJson(component) : null;
|
final ATextComponent component = TextComponentCodec.V1_20_3.deserializeNbtTree(tag);
|
||||||
|
return component != null ? SerializerVersion.V1_19_4.toJson(component) : null;
|
||||||
|
} catch (final Exception e) {
|
||||||
|
Via.getPlatform().getLogger().log(Level.SEVERE, "Error converting tag: " + tag, e);
|
||||||
|
return plainToJson("<error>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static @Nullable Tag jsonToTag(@Nullable final JsonElement element) {
|
public static @Nullable Tag jsonToTag(@Nullable final JsonElement element) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren