[SPIGOT-5980] Written books end up being marked as 'resolved' even though they aren't Created: 10/Jul/20  Updated: 12/Jun/23  Resolved: 31/Dec/20

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: blablubbabc Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: book, itemmeta, serialization

Issue Links:
Relates
relates to SPIGOT-7387 resolved property of CraftMetaBook is... Open
Version: This server is running CraftBukkit version git-Spigot-ad703da-e2403a3 (MC: 1.16.1) (Implementing API version 1.16.1-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

CraftMetaBookSigned will always assume that the book's pages have already been resolved and it will always insert the `resolved: true` entry when applying the ItemMeta back to an ItemStack.

This will not only happen when initiated by a plugin, but also when a creative mode player opens his inventory or when a player drags the book item around inside his inventory.

The result is that book items which have not yet been resolved end up being marked as resolved, breaking their page contents.

Example: A book item is created with this command:

/minecraft:give @s minecraft:written_book{author:"blablubbabc",title:"Test",pages:['{"selector":"@p"}']}

When investigating the item's internal data via "/data get entity @s" it shows as this: http://prntscr.com/tffvcw

When opening the book it is expected to get resolved and then show as this: http://prntscr.com/tffvwa and it's data will have become this: http://prntscr.com/tffw9b

However, when testing this in creative mode and opening the inventory before the item has been resolved (or by dragging the item around inside the inventory), CraftBukkit will convert the item to a corresponding Bukkit ItemStack (and thereby extract its data into CraftMetaBookSigned) and then (after the inventory event has been handled) convert this Bukkit ItemStack back to a Minecraft ItemStack. This will convert / apply the extracted CraftMetaBookSigned item meta back to the corresponding Minecraft item data.

The result is a book item with this data: http://prntscr.com/tffyp4 which is displayed like this in game when being opened: http://prntscr.com/tffz2d

The same happens whena plugin serializes and deserializes the book item.

This issue is similar to https://hub.spigotmc.org/jira/browse/SPIGOT-5063 but is concerned with the book's "resolved" attribute rather than text data.



 Comments   
Comment by blablubbabc [ 10/Jul/20 ]

They are related because the ItemMeta for books currently uses this resolved flag to determine whether it should parse pages from the JSON format or from plain text. So this ticket cannot be properly fixed without also making changes to how the book meta decides how to parse / interpret the text data for pages.

Comment by md_5 [ 10/Jul/20 ]

Please don't fix multiple unrelated issues in the same PR

Comment by blablubbabc [ 10/Jul/20 ]

I will try to include a fix for this as part of https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/707/

Generated at Sat Dec 13 15:25:47 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.