Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-5980

Written books end up being marked as 'resolved' even though they aren't

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • This server is running CraftBukkit version git-Spigot-ad703da-e2403a3 (MC: 1.16.1) (Implementing API version 1.16.1-R0.1-SNAPSHOT)
    • Yes

      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.

            Unassigned Unassigned
            blablubbabc blablubbabc
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: