Class CrossbowBuilder
java.lang.Object
io.github.lucfr1746.llibrary.itemstack.ItemBuilder
io.github.lucfr1746.llibrary.itemstack.CrossbowBuilder
The
CrossbowBuilder
class extends ItemBuilder
to provide
additional functionality for modifying CrossbowMeta
of an ItemStack
.
This class allows setting, adding, and retrieving charged projectiles.-
Constructor Summary
ConstructorsConstructorDescriptionConstructs aCrossbowBuilder
with a new crossbow item.CrossbowBuilder
(@NotNull org.bukkit.inventory.ItemStack itemStack) Constructs aCrossbowBuilder
using an existingItemStack
. -
Method Summary
Modifier and TypeMethodDescriptionaddChargedProjectile
(@NotNull org.bukkit.inventory.ItemStack item) Adds a charged projectile to the crossbow.List
<org.bukkit.inventory.ItemStack> Gets the list of charged projectiles from the crossbow.boolean
Checks if the crossbow has any charged projectiles.setChargedProjectiles
(@NotNull List<org.bukkit.inventory.ItemStack> projectiles) Sets the list of charged projectiles for the crossbow.Methods 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
-
CrossbowBuilder
public CrossbowBuilder()Constructs aCrossbowBuilder
with a new crossbow item. -
CrossbowBuilder
public CrossbowBuilder(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack) Constructs aCrossbowBuilder
using an existingItemStack
.- Parameters:
itemStack
- the item stack to modify- Throws:
IllegalArgumentException
- if the item's meta is not an instance ofCrossbowMeta
-
-
Method Details
-
addChargedProjectile
Adds a charged projectile to the crossbow.- Parameters:
item
- the projectile to add- Returns:
- this
CrossbowBuilder
instance for method chaining
-
setChargedProjectiles
public CrossbowBuilder setChargedProjectiles(@NotNull @NotNull List<org.bukkit.inventory.ItemStack> projectiles) Sets the list of charged projectiles for the crossbow.- Parameters:
projectiles
- the list of projectiles to set- Returns:
- this
CrossbowBuilder
instance for method chaining
-
getChargedProjectiles
Gets the list of charged projectiles from the crossbow.- Returns:
- an immutable list of charged projectiles
-
hasChargedProjectiles
public boolean hasChargedProjectiles()Checks if the crossbow has any charged projectiles.- Returns:
- true if the crossbow has charged projectiles, false otherwise
-