Interface ItemContext

All Superinterfaces:
EffectContext

public interface ItemContext extends EffectContext
Context for item-related enchantment effects.

Provides access to player, item, equipment slot, durability, and item action data during durability changes, drops, pickups, and crafting/anvil operations.

Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Gets the current durability of the item.
    int
    Gets the damage being taken by this item.
    @NotNull org.bukkit.inventory.ItemStack
    Gets the item being processed.
    @NotNull org.bukkit.Location
    Gets the location of the item.
    int
    Gets the maximum durability of the item.
    @Nullable org.bukkit.entity.Player
    Gets the player holding the item.
    @Nullable org.bukkit.inventory.EquipmentSlot
    Gets the equipment slot where the item is held.
    boolean
    Checks if the item is being combined in an anvil.
    boolean
    Checks if the item is being used as a crafting ingredient.
    boolean
    Checks if this event is an item drop.
    boolean
    Checks if this event is an item pickup.
    void
    reduceDamage(int reduction)
    Reduces the damage taken by a specified amount.
    void
    setDamageTaken(int damage)
    Sets the damage to be taken by this item.
    boolean
    Checks if the item will break from this damage.

    Methods inherited from interface io.artificial.enchantments.api.context.EffectContext

    getEnchantment, getLevel, getScaledValue, isCancellable, isCancelled, tryCancel
  • Method Details

    • getPlayer

      @Nullable @Nullable org.bukkit.entity.Player getPlayer()
      Gets the player holding the item.
      Returns:
      the player, or null for environmental item events
    • getItem

      @NotNull @NotNull org.bukkit.inventory.ItemStack getItem()
      Gets the item being processed.
      Returns:
      the item
    • getSlot

      @Nullable @Nullable org.bukkit.inventory.EquipmentSlot getSlot()
      Gets the equipment slot where the item is held.
      Returns:
      the slot, or null if not applicable
    • getLocation

      @NotNull @NotNull org.bukkit.Location getLocation()
      Gets the location of the item.
      Returns:
      the item location
    • getCurrentDurability

      int getCurrentDurability()
      Gets the current durability of the item.
      Returns:
      current durability value
    • getMaxDurability

      int getMaxDurability()
      Gets the maximum durability of the item.
      Returns:
      maximum durability value
    • getDamageTaken

      int getDamageTaken()
      Gets the damage being taken by this item.
      Returns:
      the damage amount
    • setDamageTaken

      void setDamageTaken(int damage)
      Sets the damage to be taken by this item.
      Parameters:
      damage - the new damage amount
    • reduceDamage

      void reduceDamage(int reduction)
      Reduces the damage taken by a specified amount.
      Parameters:
      reduction - the amount to reduce
    • willBreak

      boolean willBreak()
      Checks if the item will break from this damage.
      Returns:
      true if item will break
    • isDrop

      boolean isDrop()
      Checks if this event is an item drop.
      Returns:
      true if dropping
    • isPickup

      boolean isPickup()
      Checks if this event is an item pickup.
      Returns:
      true if picking up
    • isCraftingIngredient

      boolean isCraftingIngredient()
      Checks if the item is being used as a crafting ingredient.
      Returns:
      true if in crafting
    • isAnvilCombination

      boolean isAnvilCombination()
      Checks if the item is being combined in an anvil.
      Returns:
      true if in anvil