Interface BookMeta
- All Superinterfaces:
Book,Buildable<Book,,Book.Builder> Cloneable,ConfigurationSerializable,net.kyori.examination.Examinable,ItemMeta,PersistentDataHolder,PersistentDataViewHolder,WritableBookMeta
Material.WRITTEN_BOOK that can have a title, an author,
and pages.
Before using this type, make sure to check the itemstack's material with
ItemStack.getType(). instanceof on
the meta instance is not sufficient due to unusual inheritance
with relation to WritableBookMeta.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic enumRepresents the generation (or level of copying) of a written bookstatic classNested classes/interfaces inherited from interface net.kyori.adventure.inventory.Book
Book.Builder -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.voidAdds new pages to the end of the book.author()Gets the author of the book.Sets the author of the book.clone()Gets the author of the book.Gets the generation of the book.getPage(int page) Deprecated.usepage(int)getPages()Deprecated.useBook.pages()getTitle()Gets the title of the book.booleanChecks for the existence of an author in the book.booleanChecks for the existence of generation level in the book.booleanhasTitle()Checks for the existence of a title in the book.page(int page) Gets the specified page in the book.voidSets the specified page in the book.voidSets the author of the book.voidsetGeneration(@Nullable BookMeta.Generation generation) Sets the generation of the book.voidDeprecated.voidDeprecated.voidDeprecated.useBook.pages(List)booleanSets the title of the book.spigot()title()Gets the title of the book.Sets the title of the book.Create a new builder initialized with the attributes of this book.Methods inherited from interface org.bukkit.configuration.serialization.ConfigurationSerializable
serializeMethods inherited from interface net.kyori.examination.Examinable
examinableName, examinableProperties, examineMethods inherited from interface org.bukkit.inventory.meta.ItemMeta
addAttributeModifier, addEnchant, addItemFlags, customName, customName, displayName, displayName, getAsComponentString, getAsString, getAttributeModifiers, getAttributeModifiers, getAttributeModifiers, getCanDestroy, getCanPlaceOn, getCustomModelData, getCustomModelDataComponent, getCustomTagContainer, getDamageResistant, getDestroyableKeys, getDisplayName, getDisplayNameComponent, getEnchantable, getEnchantLevel, getEnchantmentGlintOverride, getEnchants, getEquippable, getFood, getItemFlags, getItemModel, getItemName, getJukeboxPlayable, getLocalizedName, getLore, getLoreComponents, getMaxStackSize, getPlaceableKeys, getRarity, getTool, getTooltipStyle, getUseCooldown, getUseRemainder, hasAttributeModifiers, hasConflictingEnchant, hasCustomModelData, hasCustomName, hasDamageResistant, hasDestroyableKeys, hasDisplayName, hasEnchant, hasEnchantable, hasEnchantmentGlintOverride, hasEnchants, hasEquippable, hasFood, hasItemFlag, hasItemModel, hasItemName, hasJukeboxPlayable, hasLocalizedName, hasLore, hasMaxStackSize, hasPlaceableKeys, hasRarity, hasTool, hasTooltipStyle, hasUseCooldown, hasUseRemainder, isFireResistant, isGlider, isHideTooltip, isUnbreakable, itemName, itemName, lore, lore, removeAttributeModifier, removeAttributeModifier, removeAttributeModifier, removeEnchant, removeEnchantments, removeItemFlags, setAttributeModifiers, setCanDestroy, setCanPlaceOn, setCustomModelData, setCustomModelDataComponent, setDamageResistant, setDestroyableKeys, setDisplayName, setDisplayNameComponent, setEnchantable, setEnchantmentGlintOverride, setEquippable, setFireResistant, setFood, setGlider, setHideTooltip, setItemModel, setItemName, setJukeboxPlayable, setLocalizedName, setLore, setLoreComponents, setMaxStackSize, setPlaceableKeys, setRarity, setTool, setTooltipStyle, setUnbreakable, setUseCooldown, setUseRemainder, setVersionMethods inherited from interface org.bukkit.persistence.PersistentDataHolder
getPersistentDataContainerMethods inherited from interface org.bukkit.inventory.meta.WritableBookMeta
getPageCount, hasPages
-
Method Details
-
hasTitle
boolean hasTitle()Checks for the existence of a title in the book.- Returns:
- true if the book has a title
-
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
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
Gets the author of the book.Plugins should check that hasAuthor() returns true before calling this method.
- Returns:
- the author of the book
-
setAuthor
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
Gets the generation of the book.Plugins should check that hasGeneration() returns true before calling this method.
- Returns:
- the generation of the book
-
setGeneration
Sets the generation of the book. Removes generation when given null.- Parameters:
generation- the generation to set
-
clone
- Specified by:
clonein interfaceItemMeta- Specified by:
clonein interfaceWritableBookMeta
-
getPage
Deprecated.usepage(int)Description copied from interface:WritableBookMetaGets the specified page in the book. The given page must exist.Pages are 1-indexed.
- Specified by:
getPagein interfaceWritableBookMeta- Parameters:
page- the page number to get, in range [1, getPageCount()]- Returns:
- the page from the book
-
setPage
Deprecated.Description copied from interface:WritableBookMetaSets 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.
- Specified by:
setPagein interfaceWritableBookMeta- Parameters:
page- the page number to set, in range [1, getPageCount()]data- the data to set for that page
-
getPages
Deprecated.useBook.pages()Description copied from interface:WritableBookMetaGets all the pages in the book.- Specified by:
getPagesin interfaceWritableBookMeta- Returns:
- list of all the pages in the book
-
setPages
Deprecated.useBook.pages(List)Description copied from interface:WritableBookMetaClears the existing book pages, and sets the book to use the provided pages. Maximum 100 pages with 1024 characters per page.- Specified by:
setPagesin interfaceWritableBookMeta- Parameters:
pages- A list of pages to set the book to use
-
setPages
Deprecated.Description copied from interface:WritableBookMetaClears the existing book pages, and sets the book to use the provided pages. Maximum 100 pages with 1024 characters per page.- Specified by:
setPagesin interfaceWritableBookMeta- Parameters:
pages- A list of strings, each being a page
-
addPage
Deprecated.Description copied from interface:WritableBookMetaAdds new pages to the end of the book. Up to a maximum of 100 pages with 1024 characters per page.- Specified by:
addPagein interfaceWritableBookMeta- Parameters:
pages- A list of strings, each being a page
-
title
Gets the title of the book.Plugins should check that hasTitle() returns true before calling this method.
-
title
@Contract(value="_ -> this", pure=false) @NotNull @NotNull BookMeta title(@Nullable Component title) Sets the title of the book.Limited to 32 characters. Removes title when given null.
-
author
Gets the author of the book.Plugins should check that hasAuthor() returns true before calling this method.
-
author
@Contract(value="_ -> this", pure=false) @NotNull @NotNull BookMeta author(@Nullable Component author) Sets the author of the book. Removes author when given null. -
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
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.
- Parameters:
page- the page number to set, in range [1, getPageCount()]data- the data to set for that page
-
addPages
Adds new pages to the end of the book. Up to a maximum of 100 pages with 1024 characters per page.- Parameters:
pages- A list of strings, each being a page
-
toBuilder
Description copied from interface:net.kyori.adventure.inventory.BookCreate a new builder initialized with the attributes of this book. -
spigot
-
addPages(net.kyori.adventure.text.Component...)