Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
BookMeta.java
1 package org.bukkit.inventory.meta;
2 
3 import java.util.List;
4 
5 import org.bukkit.Material;
6 
7 /**
8  * Represents a book ({@link Material#BOOK_AND_QUILL} or {@link
9  * Material#WRITTEN_BOOK}) that can have a title, an author, and pages.
10  */
11 public interface BookMeta extends ItemMeta {
12 
13  /**
14  * Checks for the existence of a title in the book.
15  *
16  * @return true if the book has a title
17  */
18  boolean hasTitle();
19 
20  /**
21  * Gets the title of the book.
22  * <p>
23  * Plugins should check that hasTitle() returns true before calling this
24  * method.
25  *
26  * @return the title of the book
27  */
28  String getTitle();
29 
30  /**
31  * Sets the title of the book.
32  * <p>
33  * Limited to 16 characters. Removes title when given null.
34  *
35  * @param title the title to set
36  * @return true if the title was successfully set
37  */
38  boolean setTitle(String title);
39 
40  /**
41  * Checks for the existence of an author in the book.
42  *
43  * @return the author of the book
44  */
45  boolean hasAuthor();
46 
47  /**
48  * Gets the author of the book.
49  * <p>
50  * Plugins should check that hasAuthor() returns true before calling this
51  * method.
52  *
53  * @return the author of the book
54  */
55  String getAuthor();
56 
57  /**
58  * Sets the author of the book. Removes author when given null.
59  *
60  * @param author the author of the book
61  */
62  void setAuthor(String author);
63 
64  /**
65  * Checks for the existence of pages in the book.
66  *
67  * @return true if the book has pages
68  */
69  boolean hasPages();
70 
71  /**
72  * Gets the specified page in the book. The given page must exist.
73  *
74  * @param page the page number to get
75  * @return the page from the book
76  */
77  String getPage(int page);
78 
79  /**
80  * Sets the specified page in the book. Pages of the book must be
81  * contiguous.
82  * <p>
83  * The data can be up to 256 characters in length, additional characters
84  * are truncated.
85  *
86  * @param page the page number to set
87  * @param data the data to set for that page
88  */
89  void setPage(int page, String data);
90 
91  /**
92  * Gets all the pages in the book.
93  *
94  * @return list of all the pages in the book
95  */
96  List<String> getPages();
97 
98  /**
99  * Clears the existing book pages, and sets the book to use the provided
100  * pages. Maximum 50 pages with 256 characters per page.
101  *
102  * @param pages A list of pages to set the book to use
103  */
104  void setPages(List<String> pages);
105 
106  /**
107  * Clears the existing book pages, and sets the book to use the provided
108  * pages. Maximum 50 pages with 256 characters per page.
109  *
110  * @param pages A list of strings, each being a page
111  */
112  void setPages(String... pages);
113 
114  /**
115  * Adds new pages to the end of the book. Up to a maximum of 50 pages with
116  * 256 characters per page.
117  *
118  * @param pages A list of strings, each being a page
119  */
120  void addPage(String... pages);
121 
122  /**
123  * Gets the number of pages in the book.
124  *
125  * @return the number of pages in the book
126  */
127  int getPageCount();
128 
129  BookMeta clone();
130 }
boolean setTitle(String title)
void setPages(List< String > pages)
void addPage(String...pages)
void setPage(int page, String data)