mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-25 11:35:18 +01:00
Catch tag to json conversion exceptions
This commit is contained in:
parent
bae3d8ec8a
commit
7b4d544e85
@ -53,8 +53,13 @@ public final class ComponentUtil {
|
||||
}
|
||||
|
||||
public static @Nullable JsonElement tagToJson(@Nullable final Tag tag) {
|
||||
final ATextComponent component = TextComponentCodec.V1_20_3.deserializeNbtTree(tag);
|
||||
return component != null ? SerializerVersion.V1_19_4.toJson(component) : null;
|
||||
try {
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user