接口 BookMeta

所有超级接口:
Cloneable, ConfigurationSerializable, ItemMeta, PersistentDataHolder

public interface BookMeta extends ItemMeta
代表书(Material.WRITABLE_BOOK或者成书),可以有标题,作者,页面.
  • 方法详细资料

    • hasTitle

      boolean hasTitle()
      检测书是否存在标题.

      原文:Checks for the existence of a title in the book.

      返回:
      这本书是否有标题
    • getTitle

      获取这本书的标题.

      插件应该在调用这个方法之前检测hasTitle()是否返回true.

      原文:Gets the title of the book.

      Plugins should check that hasTitle() returns true before calling this method.

      返回:
      这本书的标题
    • setTitle

      boolean setTitle(@Nullable @Nullable String title)
      设置这本书的标题.

      仅限32个字符.如果设置为null将移除标题.

      原文:Sets the title of the book.

      Limited to 32 characters. Removes title when given null.

      参数:
      title - 要设置的标题
      返回:
      如果成功设置标题则为true
    • hasAuthor

      boolean hasAuthor()
      检测这本书是否存在作者.

      原文:Checks for the existence of an author in the book.

      返回:
      这本书是否有作者
    • getAuthor

      获取这本书的作者.

      插件应该在调用这个方法之前检测hasAuthor()是否返回true.

      原文:Gets the author of the book.

      Plugins should check that hasAuthor() returns true before calling this method.

      返回:
      这本书的作者
    • setAuthor

      void setAuthor(@Nullable @Nullable String author)
      设置这本书的作者.如果设置为null将移除作者.

      原文:Sets the author of the book. Removes author when given null.

      参数:
      author - 这本书的作者
    • hasGeneration

      boolean hasGeneration()
      检测本书是否存在代次级别.

      原文: Checks for the existence of generation level in the book.

      返回:
      本书是否存在代次级别
    • getGeneration

      获取本书的代次. 插件应该在调用这个方法之前检测 hasGeneration() 是否返回 true.

      原文: Gets the generation of the book.

      Plugins should check that hasGeneration() returns true before calling this method.

      返回:
      本书的代次
    • setGeneration

      void setGeneration(@Nullable @Nullable BookMeta.Generation generation)
      设置本书的代次. 当参数为 null 时移除代次.

      原文: Sets the generation of the book. Removes generation when given null.

      参数:
      generation - 要设置的代次
    • hasPages

      boolean hasPages()
      检测这本书是否存在页面.

      原文:Checks for the existence of pages in the book.

      返回:
      如果这本书有页面返回true
    • getPage

      @NotNull @NotNull String getPage(int page)
      获取这本书指定页面的内容.给定的页面必须存在.

      页码在1-书本总页数范围内.

      原文:Gets the specified page in the book. The given page must exist.

      Pages are 1-indexed.

      参数:
      page - 指定页码
      返回:
      这个页码的内容
    • setPage

      void setPage(int page, @NotNull @NotNull String data)
      设置这本书指定页面的内容.书页必须是连续的.

      数据的长度最大为256个字符,超出部分将被截断.

      页码在1-书本总页数范围内.

      原文:Sets the specified page in the book. Pages of the book must be contiguous.

      The data can be up to 256 characters in length, additional characters are truncated.

      Pages are 1-indexed.

      参数:
      page - 要设置的页码,在[1, getPageCount()]区间内
      data - 那个书页的内容
    • getPages

      获取这本书的全部页面.

      原文:Gets all the pages in the book.

      返回:
      这本书的全部页面的内容
    • setPages

      void setPages(@NotNull @NotNull List<String> pages)
      清除存在的书页,并设置书提供的书页.最多100页,每页最多256个字符.

      原文:Clears the existing book pages, and sets the book to use the provided pages. Maximum 100 pages with 256 characters per page.

      参数:
      pages - 要设置的书页的内容的列表
    • setPages

      void setPages(@NotNull @NotNull String... pages)
      清除存在的书页,并设置书提供的书页.最多50页,每页最多256个字符.

      原文:Clears the existing book pages, and sets the book to use the provided pages. Maximum 50 pages with 256 characters per page.

      参数:
      pages - 每页的内容的列表
    • addPage

      void addPage(@NotNull @NotNull String... pages)
      在这本书的最后添加页面.最多50页,每页最多256个字符.

      原文:Adds new pages to the end of the book. Up to a maximum of 50 pages with 256 characters per page.

      参数:
      pages - 每页的内容的列表
    • getPageCount

      int getPageCount()
      获取这本书有多少页.

      原文:Gets the number of pages in the book.

      返回:
      这本书的页数
    • clone

      指定者:
      clone 在接口中 ItemMeta
    • spigot