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

Allow the use of JSON containing modifiers for book pages in BookMeta.

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Done
    • Icon: Minor Minor
    • None
    • None
    • This server is running CraftBukkit version git-Bukkit-4b84363 (MC: 1.13.2) (Implementing API version 1.13.2-R0.1-SNAPSHOT)
    • Yes

      BookMeta's getPage() method returns strings such as "§aThis text is coloured green§0". These strings contain colour data but do not contain the new modifiers such as:

      • Tooltips
      • Click events (URLs and Commands)

      Currently using the Bukkit API, it is not possible to create a book or retrieve from a book with such features. I propose adding methods that both allow retrieving and setting a book's page with serialised JSON that is the same used in command blocks to create these books. This JSON parsing is already well defined in ChatSerializer.

      The new methods, following the current method structure, could be:

      • getPageAsJson(int pageNumber)
      • setPageFromJson(String json)
      • getPagesAsJson()
      • setPagesFromJson(List<String> jsonPages)
      • setPagesFromJson(String... json)

      These methods will now allow plugin developers to create a book with tooltips and click events using the same JSON used in a command block to create these books.

       

       

      All of these features will now be possible to create with the Bukkit API just like they are with command blocks.

            Unassigned Unassigned
            BleedObsidian Jesse Prescott
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: