13
0
geforkt von Mirrors/Paper

Use JsonSerializationContext#serialize instead of recursion for AdventureComponents - fixes #5580 and #5371

Dieser Commit ist enthalten in:
Jason Penilla 2021-05-06 03:32:52 -07:00
Ursprung 57b254d94f
Commit e57a4cbe72

Datei anzeigen

@ -1038,6 +1038,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
gsonbuilder.registerTypeHierarchyAdapter(IChatBaseComponent.class, new IChatBaseComponent.ChatSerializer());
gsonbuilder.registerTypeHierarchyAdapter(ChatModifier.class, new ChatModifier.ChatModifierSerializer());
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
return jsonobject;
}