Class BookBuilder
java.lang.Object
io.github.lucfr1746.llibrary.itemstack.ItemBuilder
io.github.lucfr1746.llibrary.itemstack.WritableBookBuilder
io.github.lucfr1746.llibrary.itemstack.BookBuilder
The
BookMetaBuilder class extends WritableBookBuilder to provide
additional functionality for modifying BookMeta of an ItemStack.
This class allows setting the title, author, and generation of a written book.-
Constructor Summary
ConstructorsConstructorDescriptionBookBuilder(@NotNull org.bukkit.Material material) Constructs aBookMetaBuilderwith the specifiedMaterial.BookBuilder(@NotNull org.bukkit.inventory.ItemStack itemStack) Constructs aBookMetaBuilderusing an existingItemStack. -
Method Summary
Modifier and TypeMethodDescriptionGets the author of the book.org.bukkit.inventory.meta.BookMeta.GenerationGets the generation of the book.getTitle()Gets the title of the book.booleanChecks if the book has an author.booleanChecks if the book has a generation set.booleanhasTitle()Checks if the book has a title.Sets the author of the book.setGeneration(org.bukkit.inventory.meta.BookMeta.Generation generation) Sets the generation of the book.booleanSets the title of the book.Methods inherited from class io.github.lucfr1746.llibrary.itemstack.WritableBookBuilder
addPage, clearPages, getPage, getPageCount, getPages, hasPages, setPage, setPages, setPagesMethods inherited from class io.github.lucfr1746.llibrary.itemstack.ItemBuilder
addAttributeModifier, addEnchant, addEnchant, addEnchant, addItemFlags, addLore, build, getAmount, getAttributeModifiers, getAttributeModifiers, getAttributeModifiers, getCustomModelData, getDamageResistant, getDisplayName, getEnchantable, getEnchantLevel, getEnchantmentGlintOverride, getEnchants, getEquippableComponent, getFoodComponent, getItemFlags, getItemMeta, getItemModel, getJukeboxPlayableComponent, getMaxStackSize, getRarity, getToolComponent, getTooltipStyle, getTranslationKey, getType, getUseCooldownComponent, getUseRemainder, hasAttributeModifiers, hasConflictingEnchant, hasCustomModelData, hasDamageResistant, hasEnchant, hasEnchantable, hasEnchantmentGlintOverride, hasEnchants, hasEquippableComponent, hasFoodComponent, hasItemFlag, hasItemModel, hasJukeboxPlayableComponent, hasMaxStackSize, hasRarity, hasToolComponent, hasTooltipStyle, hasUseCooldownComponent, hasUseRemainder, hideAllItemFlags, insertLore, isGlider, isHideTooltip, isUnbreakable, removeAttributeModifier, removeAttributeModifier, removeAttributeModifier, removeEnchant, removeEnchants, removeItemFlags, replaceLore, setAmount, setAttributeModifiers, setCustomModelData, setDamageResistant, setDisplayName, setEnchantable, setEnchantmentGlintOverride, setEquippableComponent, setEquippableComponent, setFood, setFoodComponent, setGlider, setHideTooltip, setItemModel, setItemModel, setJukeboxPlayableComponent, setJukeboxPlayableComponent, setJukeboxPlayableComponent, setLores, setLores, setMaxStackSize, setRarity, setToolComponent, setToolComponent, setTooltipStyle, setTooltipStyle, setType, setUnbreakable, setUseCooldownComponent, setUseCooldownComponent, setUseCooldownComponent, setUseRemainder
-
Constructor Details
-
BookBuilder
public BookBuilder(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack) Constructs aBookMetaBuilderusing an existingItemStack.- Parameters:
itemStack- the item stack to modify- Throws:
IllegalArgumentException- if the item's meta is not an instance ofBookMeta
-
BookBuilder
public BookBuilder(@NotNull @NotNull org.bukkit.Material material) Constructs aBookMetaBuilderwith the specifiedMaterial.- Parameters:
material- the material for the item stack- Throws:
IllegalArgumentException- if the item's meta is not an instance ofBookMeta
-
-
Method Details
-
setTitle
Sets the title of the book.- Parameters:
title- the title to set- Returns:
- true if the title was successfully set, false otherwise
-
getTitle
Gets the title of the book.- Returns:
- the title of the book, or null if none is set
-
hasTitle
public boolean hasTitle()Checks if the book has a title.- Returns:
- true if the book has a title, false otherwise
-
setAuthor
Sets the author of the book.- Parameters:
author- the author to set- Returns:
- this
BookMetaBuilderinstance for method chaining
-
getAuthor
Gets the author of the book.- Returns:
- the author of the book, or null if none is set
-
hasAuthor
public boolean hasAuthor()Checks if the book has an author.- Returns:
- true if the book has an author, false otherwise
-
setGeneration
Sets the generation of the book.- Parameters:
generation- the generation to set- Returns:
- this
BookMetaBuilderinstance for method chaining
-
getGeneration
public org.bukkit.inventory.meta.BookMeta.Generation getGeneration()Gets the generation of the book.- Returns:
- the generation of the book, or null if none is set
-
hasGeneration
public boolean hasGeneration()Checks if the book has a generation set.- Returns:
- true if the book has a generation, false otherwise
-