org.bukkit.inventory.meta
Interface BookMeta

All Superinterfaces:
Cloneable, ConfigurationSerializable, ItemMeta

public interface BookMeta
extends ItemMeta

Represents a book (Material.BOOK_AND_QUILL or Material.WRITTEN_BOOK) that can have a title, an author, and pages.


Method Summary
 void addPage(String... pages)
          Adds new pages to the end of the book.
 BookMeta clone()
           
 String getAuthor()
          Gets the author of the book.
 String getPage(int page)
          Gets the specified page in the book.
 int getPageCount()
          Gets the number of pages in the book.
 List<String> getPages()
          Gets all the pages in the book.
 String getTitle()
          Gets the title of the book.
 boolean hasAuthor()
          Checks for the existence of an author in the book.
 boolean hasPages()
          Checks for the existence of pages in the book.
 boolean hasTitle()
          Checks for the existence of a title in the book.
 void setAuthor(String author)
          Sets the author of the book.
 void setPage(int page, String data)
          Sets the specified page in the book.
 void setPages(List<String> pages)
          Clears the existing book pages, and sets the book to use the provided pages.
 void setPages(String... pages)
          Clears the existing book pages, and sets the book to use the provided pages.
 boolean setTitle(String title)
          Sets the title of the book.
 
Methods inherited from interface org.bukkit.inventory.meta.ItemMeta
addEnchant, getDisplayName, getEnchantLevel, getEnchants, getLore, hasDisplayName, hasEnchant, hasEnchants, hasLore, removeEnchant, setDisplayName, setLore
 
Methods inherited from interface org.bukkit.configuration.serialization.ConfigurationSerializable
serialize
 

Method Detail

hasTitle

boolean hasTitle()
Checks for the existence of a title in the book.

Returns:
true if the book has a title

getTitle

String getTitle()
Gets the title of the book. Plugins should check that hasTitle() returns true before calling this method.

Returns:
the title of the book

setTitle

boolean setTitle(String title)
Sets the title of the book. Limited to 16 characters. Removes title when given null.

Parameters:
title - the title to set
Returns:
true if the title was successfully set

hasAuthor

boolean hasAuthor()
Checks for the existence of an author in the book.

Returns:
the author of the book

getAuthor

String getAuthor()
Gets the author of the book. Plugins should check that hasAuthor() returns true before calling this method.

Returns:
the author of the book

setAuthor

void setAuthor(String author)
Sets the author of the book. Removes author when given null.

Parameters:
author - the author of the book

hasPages

boolean hasPages()
Checks for the existence of pages in the book.

Returns:
true if the book has pages

getPage

String getPage(int page)
Gets the specified page in the book. The given page must exist.

Parameters:
page - the page number to get
Returns:
the page from the book

setPage

void setPage(int page,
             String data)
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 trucated.

Parameters:
page - the page number to set
data - the data to set for that page

getPages

List<String> getPages()
Gets all the pages in the book.

Returns:
list of all the pages in the book

setPages

void setPages(List<String> pages)
Clears the existing book pages, and sets the book to use the provided pages. Maximum 50 pages with 256 characters per page.

Parameters:
pages - A list of pages to set the book to use

setPages

void setPages(String... pages)
Clears the existing book pages, and sets the book to use the provided pages. Maximum 50 pages with 256 characters per page.

Parameters:
pages - A list of strings, each being a page

addPage

void addPage(String... pages)
Adds new pages to the end of the book. Up to a maximum of 50 pages with 256 characters per page.

Parameters:
pages - A list of strings, each being a page

getPageCount

int getPageCount()
Gets the number of pages in the book.

Returns:
the number of pages in the book

clone

BookMeta clone()
Specified by:
clone in interface ItemMeta


Copyright © 2013. All Rights Reserved.