Package org.bukkit.inventory.meta

# Interface BookMeta

All Superinterfaces:
  `Book`, `Buildable<Book,Book.Builder>`, `Cloneable`, `ConfigurationSerializable`, `net.kyori.examination.Examinable`, `ItemMeta`, `PersistentDataHolder`

public interface BookMeta extends ItemMeta, Book
Represents a book (`Material.WRITABLE_BOOK` or `Material.WRITTEN_BOOK`) that can have a title, an author, and pages.

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static interface`
`BookMeta.BookMetaBuilder`
`static enum`
`BookMeta.Generation`
Represents the generation (or level of copying) of a written book
`static class`
`BookMeta.Spigot`

## Nested classes/interfaces inherited from interface net.kyori.adventure.inventory.Book

`Book.Builder`

## Method Summary

Modifier and Type
Method
Description
`void`
`addPage(@NotNull String... pages)`
Deprecated.
in favour of `addPages(net.kyori.adventure.text.Component...)`
`void`
`addPages(@NotNull Component... pages)`
Adds new pages to the end of the book.
`Component`
`author()`
Gets the author of the book.
`@NotNull BookMeta`
`author(Component author)`
Sets the author of the book.
`@NotNull BookMeta`
`clone()`
`@Nullable String`
`getAuthor()`
Gets the author of the book.
`@Nullable BookMeta.Generation`
`getGeneration()`
Gets the generation of the book.
`@NotNull String`
`getPage(int page)`
Deprecated.
in favour of `page(int)`
`int`
`getPageCount()`
Gets the number of pages in the book.
`@NotNull List<String>`
`getPages()`
Deprecated.
in favour of `Book.pages()`
`@Nullable String`
`getTitle()`
Gets the title of the book.
`boolean`
`hasAuthor()`
Checks for the existence of an author in the book.
`boolean`
`hasGeneration()`
Checks for the existence of generation level 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.
`Component`
`page(int page)`
Gets the specified page in the book.
`void`
`page(int page, Component data)`
Sets the specified page in the book.
`void`
`setAuthor(@Nullable String author)`
Sets the author of the book.
`void`
`setGeneration(@Nullable BookMeta.Generation generation)`
Sets the generation of the book.
`void`
`setPage(int page, @NotNull String data)`
Deprecated.
in favour of `page(int, net.kyori.adventure.text.Component)`
`void`
`setPages(@NotNull String... pages)`
Deprecated.
in favour of `Book.pages(net.kyori.adventure.text.Component...)`
`void`
`setPages(@NotNull List<String> pages)`
Deprecated.
in favour of `Book.pages(List)`
`boolean`
`setTitle(@Nullable String title)`
Sets the title of the book.
`@NotNull BookMeta.Spigot`
`spigot()`
`Component`
`title()`
Gets the title of the book.
`@NotNull BookMeta`
`title(Component title)`
Sets the title of the book.
`@NonNull BookMeta.BookMetaBuilder`
`toBuilder()`
Create a new builder initialized with the attributes of this book.

### Methods inherited from interface net.kyori.adventure.inventory.Book

`pages, pages, pages`

### Methods inherited from interface org.bukkit.configuration.serialization.ConfigurationSerializable

`serialize`

### Methods inherited from interface net.kyori.examination.Examinable

`examinableName, examinableProperties, examine`

### Methods inherited from interface org.bukkit.inventory.meta.ItemMeta

`addAttributeModifier, addEnchant, addItemFlags, displayName, displayName, getAttributeModifiers, getAttributeModifiers, getAttributeModifiers, getCanDestroy, getCanPlaceOn, getCustomModelData, getCustomTagContainer, getDestroyableKeys, getDisplayName, getDisplayNameComponent, getEnchantLevel, getEnchants, getItemFlags, getLocalizedName, getLore, getLoreComponents, getPlaceableKeys, hasAttributeModifiers, hasConflictingEnchant, hasCustomModelData, hasDestroyableKeys, hasDisplayName, hasEnchant, hasEnchants, hasItemFlag, hasLocalizedName, hasLore, hasPlaceableKeys, isUnbreakable, lore, lore, removeAttributeModifier, removeAttributeModifier, removeAttributeModifier, removeEnchant, removeItemFlags, setAttributeModifiers, setCanDestroy, setCanPlaceOn, setCustomModelData, setDestroyableKeys, setDisplayName, setDisplayNameComponent, setLocalizedName, setLore, setLoreComponents, setPlaceableKeys, setUnbreakable, setVersion`

### Methods inherited from interface org.bukkit.persistence.PersistentDataHolder

`getPersistentDataContainer`

## Method Details

### hasTitle

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

Returns:
  true if the book has a title

### getTitle

@Nullable @Nullable 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(@Nullable @Nullable String title)
Sets the title of the book.

Limited to 32 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:
  true if the book has an author

### getAuthor

@Nullable @Nullable 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(@Nullable @Nullable String author)
Sets the author of the book. Removes author when given null.

Parameters:
  `author` - the author to set

### hasGeneration

boolean hasGeneration()
Checks for the existence of generation level in the book.

Returns:
  true if the book has a generation level

### getGeneration

@Nullable @Nullable BookMeta.Generation getGeneration()
Gets the generation of the book.

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

Returns:
  the generation of the book

### setGeneration

void setGeneration(@Nullable @Nullable BookMeta.Generation generation)
Sets the generation of the book. Removes generation when given null.

Parameters:
  `generation` - the generation to set

### hasPages

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

Returns:
  true if the book has pages

### title

@Nullable Component title()
Gets the title of the book.

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

Specified by:
  `title` in interface `Book`
Returns:
  the title of the book

### title

@NotNull @NotNull BookMeta title(@Nullable Component title)
Sets the title of the book.

Limited to 32 characters. Removes title when given null.

Specified by:
  `title` in interface `Book`
Parameters:
  `title` - the title to set
Returns:
  the same `BookMeta` instance

### author

@Nullable Component author()
Gets the author of the book.

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

Specified by:
  `author` in interface `Book`
Returns:
  the author of the book

### author

@NotNull @NotNull BookMeta author(@Nullable Component author)
Sets the author of the book. Removes author when given null.

Specified by:
  `author` in interface `Book`
Parameters:
  `author` - the author to set
Returns:
  the same `BookMeta` instance

### page

@NotNull Component page(int page)
Gets the specified page in the book. The page must exist.

Pages are 1-indexed.

Parameters:
  `page` - the page number to get, in range [1, getPageCount()]
Returns:
  the page from the book

### page

void page(int page, @NotNull Component 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 truncated.

Pages are 1-indexed.

Parameters:
  `page` - the page number to set, in range [1, getPageCount()]
  `data` - the data to set for that page

### addPages

void addPages(@NotNull @NotNull Component... 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

### toBuilder

@NonNull BookMeta.BookMetaBuilder toBuilder()
Description copied from interface: `net.kyori.adventure.inventory.Book`
Create a new builder initialized with the attributes of this book.

Specified by:
  `toBuilder` in interface `Book`
Specified by:
  `toBuilder` in interface `Buildable<Book,Book.Builder>`
Returns:
  the builder

### getPage

@NotNull @Deprecated @NotNull String getPage(int page)
Deprecated.
in favour of `page(int)`
Gets the specified page in the book. The given page must exist.

Pages are 1-indexed.

Parameters:
  `page` - the page number to get, in range [1, getPageCount()]
Returns:
  the page from the book

### setPage

@Deprecated void setPage(int page, @NotNull @NotNull String data)
Deprecated.
in favour of `page(int, net.kyori.adventure.text.Component)`
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.

Parameters:
  `page` - the page number to set, in range [1, getPageCount()]
  `data` - the data to set for that page

### getPages

@NotNull @Deprecated @NotNull List<String> getPages()
Deprecated.
in favour of `Book.pages()`
Gets all the pages in the book.

Returns:
  list of all the pages in the book

### setPages

@Deprecated void setPages(@NotNull @NotNull List<String> pages)
Deprecated.
in favour of `Book.pages(List)`
Clears the existing book pages, and sets the book to use the provided pages. Maximum 100 pages with 256 characters per page.

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

### setPages

@Deprecated void setPages(@NotNull @NotNull String... pages)
Deprecated.
in favour of `Book.pages(net.kyori.adventure.text.Component...)`
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

@Deprecated void addPage(@NotNull @NotNull String... pages)
Deprecated.
in favour of `addPages(net.kyori.adventure.text.Component...)`
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

@NotNull @NotNull BookMeta clone()

Specified by:
  `clone` in interface `ItemMeta`

### spigot

@NotNull @NotNull BookMeta.Spigot spigot()