-
-
Notifications
You must be signed in to change notification settings - Fork 147
Closed
Milestone
Description
The GSON Serializer uses the deprecated ClickEvent.custom(Key Key, String data) method and causes a IllegalStateException (Expected STRING but was BEGIN_OBJECT at path $.click_event.payload) when trying to parse a ClickEvent with a custom callback that uses NBT for the payload.
Example Code
try (InputStream stream = Main.class.getResourceAsStream("/example.json")) {
BufferedReader streamReader = new BufferedReader(new InputStreamReader(stream));
JsonElement jsonElement = new JsonParser().parse(streamReader);
GsonComponentSerializer serializer = GsonComponentSerializer.builder()
.legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.get())
.build();
Component component = serializer.deserializeFromTree(jsonElement);
}{
"extra": [
{
"click_event": {
"id": "paper:click_callback",
"payload": {
"id": [
1034630811,
-1696642542,
-1523289780,
-1589453925
]
},
"action": "custom"
},
"text": "Some Text"
}
],
"text": ""
}Similar Issue for Serializer not accepting a null payload: #1326
Related: GeyserMC/Geyser#5932
onebeastchris