All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bukkit.inventory.meta.BookMeta Maven / Gradle / Ivy

There is a newer version: 2.4.0
Show newest version
package org.bukkit.inventory.meta;

import org.bukkit.Material;

import java.util.List;

/**
 * Represents a book ({@link Material#BOOK_AND_QUILL} or {@link
 * Material#WRITTEN_BOOK}) that can have a title, an author, and pages.
 */
public interface BookMeta extends ItemMeta {

  /**
   * Checks for the existence of a title in the book.
   *
   * @return true if the book has a title
   */
  boolean hasTitle();

  /**
   * Gets the title of the book.
   * 

* Plugins should check that hasTitle() returns true before calling this * method. * * @return the title of the book */ String getTitle(); /** * Sets the title of the book. *

* Limited to 16 characters. Removes title when given null. * * @param title the title to set * @return true if the title was successfully set */ boolean setTitle(String title); /** * Checks for the existence of an author in the book. * * @return the author of the book */ boolean hasAuthor(); /** * Gets the author of the book. *

* Plugins should check that hasAuthor() returns true before calling this * method. * * @return the author of the book */ String getAuthor(); /** * Sets the author of the book. Removes author when given null. * * @param author the author of the book */ void setAuthor(String author); /** * Checks for the existence of pages in the book. * * @return true if the book has pages */ boolean hasPages(); /** * Gets the specified page in the book. The given page must exist. * * @param page the page number to get * @return the page from the book */ String getPage(int page); /** * 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. * * @param page the page number to set * @param data the data to set for that page */ void setPage(int page, String data); /** * Gets all the pages in the book. * * @return list of all the pages in the book */ List getPages(); /** * Clears the existing book pages, and sets the book to use the provided * pages. Maximum 50 pages with 256 characters per page. * * @param pages A list of pages to set the book to use */ void setPages(List pages); /** * Clears the existing book pages, and sets the book to use the provided * pages. Maximum 50 pages with 256 characters per page. * * @param pages A list of strings, each being a page */ void setPages(String... pages); /** * Adds new pages to the end of the book. Up to a maximum of 50 pages with * 256 characters per page. * * @param pages A list of strings, each being a page */ void addPage(String... pages); /** * Gets the number of pages in the book. * * @return the number of pages in the book */ int getPageCount(); BookMeta clone(); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy