Use JsonSerializationContext#serialize instead of recursion for AdventureComponents - fixes #5580 and #5371
This commit is contained in:
@@ -1038,6 +1038,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
gsonbuilder.registerTypeHierarchyAdapter(IChatBaseComponent.class, new IChatBaseComponent.ChatSerializer());
|
gsonbuilder.registerTypeHierarchyAdapter(IChatBaseComponent.class, new IChatBaseComponent.ChatSerializer());
|
||||||
gsonbuilder.registerTypeHierarchyAdapter(ChatModifier.class, new ChatModifier.ChatModifierSerializer());
|
gsonbuilder.registerTypeHierarchyAdapter(ChatModifier.class, new ChatModifier.ChatModifierSerializer());
|
||||||
gsonbuilder.registerTypeAdapterFactory(new ChatTypeAdapterFactory());
|
gsonbuilder.registerTypeAdapterFactory(new ChatTypeAdapterFactory());
|
||||||
|
@@ -0,0 +0,0 @@ public interface IChatBaseComponent extends Message, IChatFormatted, Iterable<IC
|
||||||
|
}
|
||||||
|
|
||||||
|
public JsonElement serialize(IChatBaseComponent ichatbasecomponent, Type type, JsonSerializationContext jsonserializationcontext) {
|
||||||
|
+ if (ichatbasecomponent instanceof AdventureComponent) return jsonserializationcontext.serialize(ichatbasecomponent); // Paper
|
||||||
|
JsonObject jsonobject = new JsonObject();
|
||||||
|
|
||||||
|
if (!ichatbasecomponent.getChatModifier().g()) {
|
||||||
@@ -0,0 +0,0 @@ public interface IChatBaseComponent extends Message, IChatFormatted, Iterable<IC
|
@@ -0,0 +0,0 @@ public interface IChatBaseComponent extends Message, IChatFormatted, Iterable<IC
|
||||||
return jsonobject;
|
return jsonobject;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user