Class ItemBookWritable

java.lang.Object
cn.nukkit.item.Item
cn.nukkit.item.ItemBookWritable
All Implemented Interfaces:
BlockID, ItemID, Cloneable
Direct Known Subclasses:
ItemBookAndQuill, ItemBookWritten

public abstract class ItemBookWritable extends Item
  • Constructor Details

    • ItemBookWritable

      protected ItemBookWritable(int id)
    • ItemBookWritable

      protected ItemBookWritable(int id, Integer meta)
    • ItemBookWritable

      protected ItemBookWritable(int id, Integer meta, int count)
    • ItemBookWritable

      protected ItemBookWritable(int id, Integer meta, int count, String name)
  • Method Details

    • pageExists

      public boolean pageExists(int pageId)
      Returns whether the given page exists in this book.
    • getPageText

      public String getPageText(int pageId)
      Returns a string containing the content of a page (which could be empty), or null if the page doesn't exist.
    • setPageText

      public boolean setPageText(int pageId, String pageText)
      Sets the text of a page in the book. Adds the page if the page does not yet exist.
      Returns:
      boolean indicating success
    • addPage

      public boolean addPage(int pageId)
      Adds a new page with the given page ID. Creates a new page for every page between the given ID and existing pages that doesn't yet exist.
      Returns:
      boolean indicating success
    • deletePage

      public boolean deletePage(int pageId)
      Deletes an existing page with the given page ID.
      Returns:
      boolean indicating success
    • insertPage

      public boolean insertPage(int pageId)
      Inserts a new page with the given text and moves other pages upwards.
      Returns:
      boolean indicating success
    • insertPage

      public boolean insertPage(int pageId, String pageText)
      Inserts a new page with the given text and moves other pages upwards.
      Returns:
      boolean indicating success
    • swapPages

      public boolean swapPages(int pageId1, int pageId2)
      Switches the text of two pages with each other.
      Returns:
      boolean indicating success
    • getPages

      public List getPages()
      Returns an list containing all pages of this book.
    • createPageTag

      protected static CompoundTag createPageTag()
    • createPageTag

      protected static CompoundTag createPageTag(String pageText)