Class CrossbowBuilder

java.lang.Object
io.github.lucfr1746.llibrary.itemstack.ItemBuilder
io.github.lucfr1746.llibrary.itemstack.CrossbowBuilder

public class CrossbowBuilder extends ItemBuilder
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 Details

    • CrossbowBuilder

      public CrossbowBuilder()
      Constructs a CrossbowBuilder with a new crossbow item.
    • CrossbowBuilder

      public CrossbowBuilder(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack)
      Constructs a CrossbowBuilder using an existing ItemStack.
      Parameters:
      itemStack - the item stack to modify
      Throws:
      IllegalArgumentException - if the item's meta is not an instance of CrossbowMeta
  • Method Details

    • addChargedProjectile

      public CrossbowBuilder addChargedProjectile(@NotNull @NotNull org.bukkit.inventory.ItemStack item)
      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

      public List<org.bukkit.inventory.ItemStack> 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