Fix signed book page serialization (#10696)

This commit is contained in:
Jason Penilla 2024-05-11 15:13:18 -07:00 committed by GitHub
parent ac554ad46d
commit 711f82e01e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -156,7 +156,7 @@ index 12911233c01d0ac1af9adbd157d56d28361fc76f..99ee41e79891d6017f065492efab5af9
private static Material shieldToBannerHack() {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java
index 3f78a0935d738854182254b345064e3c225dcd5f..1d63632372eb8b078bbbba6f9e583eb93c902746 100644
index 3f78a0935d738854182254b345064e3c225dcd5f..218df87c596d47b431dbbf2aa42822ef174f948f 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java
@@ -116,8 +116,8 @@ public class CraftMetaBookSigned extends CraftMetaItem implements BookMeta {
@ -179,6 +179,21 @@ index 3f78a0935d738854182254b345064e3c225dcd5f..1d63632372eb8b078bbbba6f9e583eb9
}
}
@@ -358,7 +358,13 @@ public class CraftMetaBookSigned extends CraftMetaItem implements BookMeta {
}
if (this.pages != null) {
- builder.put(CraftMetaBookSigned.BOOK_PAGES.BUKKIT, ImmutableList.copyOf(this.pages));
+ // Paper start - deserialization expects json
+ final List<String> jsonPages = new ArrayList<>(this.pages.size());
+ for (final Component page : this.pages) {
+ jsonPages.add(CraftChatMessage.toJSON(page));
+ }
+ builder.put(CraftMetaBookSigned.BOOK_PAGES.BUKKIT, ImmutableList.copyOf(jsonPages));
+ // Paper end - deserialization expects json
}
if (this.resolved) {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
index 8e0dd4b7a7a25a8beb27b507047bc48d8227627c..cf5d27ccc2225bac3aa57912f444f95d2f37e32e 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java