Interface ConsumableContext

All Superinterfaces:
EffectContext

public interface ConsumableContext extends EffectContext
Context for consumable-related enchantment effects.

Provides access to player, item, food level, saturation, and health restoration data during item consumption events.

Since:
0.1.0
  • Method Details

    • getPlayer

      @NotNull @NotNull org.bukkit.entity.Player getPlayer()
      Gets the player consuming the item.
      Returns:
      the consuming player
    • getItem

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

      @NotNull @NotNull org.bukkit.Location getLocation()
      Gets the location where consumption occurred.
      Returns:
      the consumption location
    • getFoodLevel

      int getFoodLevel()
      Gets the food level change from this item.
      Returns:
      the food level
    • setFoodLevel

      void setFoodLevel(int level)
      Sets the food level change.
      Parameters:
      level - the new food level
    • getSaturation

      float getSaturation()
      Gets the saturation change from this item.
      Returns:
      the saturation value
    • setSaturation

      void setSaturation(float saturation)
      Sets the saturation change.
      Parameters:
      saturation - the new saturation value
    • getHealthRestored

      double getHealthRestored()
      Gets the health restored by this item.
      Returns:
      the health restored
    • setHealthRestored

      void setHealthRestored(double health)
      Sets the health restored.
      Parameters:
      health - the new health restored value
    • isFood

      boolean isFood()
      Checks if the consumed item is food.
      Returns:
      true if food
    • isPotion

      boolean isPotion()
      Checks if the consumed item is a potion.
      Returns:
      true if potion
    • isDrink

      boolean isDrink()
      Checks if the consumed item is a drink.
      Returns:
      true if drink
    • isAlwaysEdible

      boolean isAlwaysEdible()
      Checks if the item is edible even when not hungry.
      Returns:
      true if always edible
    • getConsumptionTime

      int getConsumptionTime()
      Gets the consumption time in ticks.
      Returns:
      the consumption time
    • setConsumptionTime

      void setConsumptionTime(int ticks)
      Sets the consumption time in ticks.
      Parameters:
      ticks - the new consumption time