-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
This server is running CraftBukkit version git-Spigot-94af569-a3fdef8 (MC: 1.14.4) (Implementing API version 1.14.4-R0.1-SNAPSHOT)
-
BookConfigTest
-
Yes
Serializing BookMeta removes hover and click events
This occurs on:
- Spigot 1.14.4
- CraftBukkit 1.14.4
And is not applicable to:
- Vanilla
Not tested:
- Spigot 1.14.3 and earlier
What happens
When you save an ItemStack of a book in a config the BookMeta does not get correctly serialized and removes hover and click events.
This is because CraftMetaBook#serialize() calls CraftChatMessage.fromComponent(IChatBaseComponent) which only returns a String containing the textual content and formatting.
Produced config file
item: ==: org.bukkit.inventory.ItemStack v: 1976 type: WRITTEN_BOOK meta: ==: ItemMeta meta-type: BOOK_SIGNED title: Test Book author: Test Author pages: - |- test click§0 §0test hover§0 §0test combined - this is page 2
Steps to reproduce
- Place the BookConfigTest.jar in your plugins folder
- Run this command from the console to get an example book
minecraft:give @p written_book{pages:["[\"\",{\"text\":\"test click\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/say test command\"}},\"\\n\",{\"text\":\"test hover\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"hover text\"}},\"\\n\",{\"text\":\"test combined\",\"clickEvent\":{\"action\":\"change_page\",\"value\":2},\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"go to page 2\"}}]","{\"text\":\"this is page 2\"}"],title:"Test Book",author:"Test Author",display:{Lore:["This is a test book"]}}
- Hold the given book in your main hand
- Execute the following commands from the player holding the book
- /dotest set
- /dotest reload
- (reloading needed because the correct item is cached otherwise)
- When you execute /dotest get you will get a book that has the same name, author, generation and formatting but the hover and click events are gone.