Interface WritableBookMeta
- All Superinterfaces:
Cloneable, ConfigurationSerializable, ItemMeta, PersistentDataHolder, PersistentDataViewHolder
- All Known Subinterfaces:
BookMeta
Represents a book (
Material.WRITABLE_BOOK) that can have pages.
For Material.WRITTEN_BOOK, use BookMeta.
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 BookMeta.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds new pages to the end of the book.clone()getPage(int page) Gets the specified page in the book.intGets the number of pages in the book.getPages()Gets all the pages in the book.booleanhasPages()Checks for the existence of pages in the book.voidSets the specified page in the book.voidClears the existing book pages, and sets the book to use the provided pages.voidClears the existing book pages, and sets the book to use the provided pages.Methods inherited from interface ConfigurationSerializable
serializeMethods inherited from interface ItemMeta
addAttributeModifier, addEnchant, addItemFlags, customName, customName, displayName, displayName, getAsComponentString, getAsString, getAttributeModifiers, getAttributeModifiers, getAttributeModifiers, getCanDestroy, getCanPlaceOn, getCustomModelData, getCustomModelDataComponent, getCustomTagContainer, getDamageResistant, getDamageResistantTypes, 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, hasCustomModelDataComponent, 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, setDamageResistantTypes, 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 PersistentDataHolder
getPersistentDataContainer
-
Method Details
-
hasPages
boolean hasPages()Checks for the existence of pages in the book.- Returns:
- true if the book has pages
-
getPage
-
setPage
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
-
getPages
-
setPages
-
setPages
-
addPage
-
getPageCount
int getPageCount()Gets the number of pages in the book.- Returns:
- the number of pages in the book
-
clone
-