Class DamageableItemBuilder

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

public class DamageableItemBuilder extends ItemBuilder
The DamageableBuilder class extends ItemBuilder to provide additional functionality for modifying Damageable items in an ItemStack. This class allows setting, retrieving, and checking damage values.
  • Constructor Details

    • DamageableItemBuilder

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

      public DamageableItemBuilder(@NotNull @NotNull org.bukkit.Material material, int amount)
      Constructs a DamageableItemBuilder with the specified Material and amount.
      Parameters:
      material - the material for the item stack
      amount - the quantity of items in the stack
      Throws:
      IllegalArgumentException - if the item's meta is not an instance of Damageable
    • DamageableItemBuilder

      public DamageableItemBuilder(@NotNull @NotNull org.bukkit.Material material)
      Constructs a DamageableItemBuilder with the specified Material.
      Parameters:
      material - the material for the item stack
      Throws:
      IllegalArgumentException - if the item's meta is not an instance of Damageable
  • Method Details

    • getDamage

      public int getDamage()
      Gets the current damage value of the item.
      Returns:
      the current damage value
    • setDamage

      public DamageableItemBuilder setDamage(int damage)
      Sets the damage value of the item.
      Parameters:
      damage - the damage value to set
      Returns:
      this DamageableItemBuilder instance for method chaining
    • getMaxDurability

      public int getMaxDurability()
      Gets the maximum amount of damage this item can take.
      Returns:
      the maximum damage value
    • setMaxDurability

      public DamageableItemBuilder setMaxDurability(int maxDurability)
      Sets the maximum damage value for the item.
      Parameters:
      maxDurability - the maximum damage value to set
      Returns:
      this DamageableItemBuilder instance for method chaining
    • hasDamage

      public boolean hasDamage()
      Checks if the item has a damage value.
      Returns:
      true if the item has damage, false otherwise
    • hasMaxDurability

      public boolean hasMaxDurability()
      Checks if the item has a maximum damage value.
      Returns:
      true if the item has a max damage value, false otherwise