Class GeneralItemStackUtils

java.lang.Object
dev.sefiraat.sefilib.itemstacks.GeneralItemStackUtils

public final class GeneralItemStackUtils extends Object
This class contains utility methods for working with ItemStacks.
  • Method Details

    • damage

      public static void damage(@Nonnull ItemStack itemStack, int amount)
      Damages the item by the provided amount.
      Parameters:
      itemStack - The ItemStack to damage.
      amount - The amount of damage to deal.
    • damage

      public static void damage(@Nonnull ItemStack itemStack, @Nullable Player player, int amount)
      Damages the item by the provided amount.
      Parameters:
      itemStack - The ItemStack to damage.
      player - The Player who damaged the item.
      amount - The amount of damage to deal.
    • repair

      public static void repair(@Nonnull ItemStack itemStack, int amount)
      Repairs the item by the provided amount.
      Parameters:
      itemStack - The ItemStack to repair.
      amount - The amount of damage to repair.
    • repair

      public static void repair(@Nonnull ItemStack itemStack, @Nullable Player player, int amount)
      Repairs the item by the provided amount.
      Parameters:
      itemStack - The ItemStack to repair.
      player - The Player who repaired the item.
      amount - The amount of damage to repair.
    • setItemDamage

      public static void setItemDamage(@Nonnull ItemStack itemStack, int amount)
      Sets the damage of the item.
      Parameters:
      itemStack - The ItemStack to set the damage of.
      amount - The amount of damage to set.
    • setItemDamage

      public static void setItemDamage(@Nonnull ItemStack itemStack, @Nullable Player player, int amount)
      Sets the damage of the item.
      Parameters:
      itemStack - The ItemStack to set the damage of.
      player - The Player who set the damage of the item.
      amount - The amount of damage to set.
    • setItemDamage

      public static void setItemDamage(@Nonnull ItemStack itemStack, @Nonnull ItemMeta itemMeta, @Nullable Player player, int amount)
      Sets the damage of the item.
      Parameters:
      itemStack - The ItemStack to set the damage of.
      itemMeta - The ItemMeta of the item.
      player - The Player who set the damage of the item.
      amount - The amount of damage to set.
    • getAsQuantity

      @Nonnull public static ItemStack getAsQuantity(@Nonnull ItemStack itemStack, int amount)
      Gets a clone of an ItemStack with the provided amount.
      Parameters:
      itemStack - The ItemStack to clone.
      amount - The amount of the clone.
      Returns:
      A clone of the ItemStack with the provided amount.