接口 WritableBookMeta

所有超级接口:
Cloneable, ConfigurationSerializable, ItemMeta, PersistentDataHolder
所有已知子接口:
BookMeta

public interface WritableBookMeta extends ItemMeta
代表一本书 (Material.WRITABLE_BOOK 或 Material.WRITTEN_BOOK),可以拥有页面.
  • 方法详细资料

    • 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 - 要获取的页码,范围为 [1, getPageCount()]
      返回:
      书中的页面
    • setPage

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

      数据长度最多为 1024 个字符,多余的字符将被截断.

      页面从 1 开始索引.

      原文:Sets the specified page in the book. Pages of the book must be contiguous. The data can be up to 1024 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 页,每页 1024 个字符.

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

      参数:
      pages - 要设置的页面列表
    • setPages

      void setPages(@NotNull @NotNull String... pages)
      清除现有的书页,并将书设置为使用提供的页面。最多 100 页,每页 1024 个字符.

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

      参数:
      pages - 字符串列表,每个字符串为一页
    • addPage

      void addPage(@NotNull @NotNull String... pages)
      向书末尾添加新页面。最多 100 页,每页 1024 个字符.

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

      参数:
      pages - 字符串列表,每个字符串为一页
    • getPageCount

      int getPageCount()
      获取书中的页数.

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

      返回:
      书中的页数
    • clone

      指定者:
      clone 在接口中 ItemMeta