Class HeirloomFoodConsumedEvent

java.lang.Object
org.bukkit.event.Event
ke.ric.api.events.HeirloomFoodConsumedEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class HeirloomFoodConsumedEvent extends org.bukkit.event.Event implements org.bukkit.event.Cancellable
Called when a player consumes a Heirloom food item. Addons can add additional effects, modify hunger restoration, or cancel consumption. This event is fired AFTER the vanilla PlayerItemConsumeEvent, allowing addons to add custom behavior on top of Heirloom's effects.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.bukkit.event.Event

    org.bukkit.event.Event.Result
  • Constructor Summary

    Constructors
    Constructor
    Description
    HeirloomFoodConsumedEvent(org.bukkit.entity.Player player, org.bukkit.inventory.ItemStack item, String customItemId, int hungerRestored, float saturationRestored)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the custom item ID if this was a Heirloom item.
    static org.bukkit.event.HandlerList
     
    org.bukkit.event.HandlerList
     
    int
    Get the hunger points restored (0-20 scale).
    org.bukkit.inventory.ItemStack
    Get the food item that was consumed.
    org.bukkit.entity.Player
    Get the player who consumed the food.
    float
    Get the saturation restored.
    boolean
     
    boolean
    Check if this was a Heirloom custom food item.
    void
    setCancelled(boolean cancelled)
     
    void
    setHungerRestored(int hunger)
    Set the hunger points to restore.
    void
    setSaturationRestored(float saturation)
    Set the saturation to restore.

    Methods inherited from class org.bukkit.event.Event

    callEvent, getEventName, isAsynchronous

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HeirloomFoodConsumedEvent

      public HeirloomFoodConsumedEvent(org.bukkit.entity.Player player, org.bukkit.inventory.ItemStack item, String customItemId, int hungerRestored, float saturationRestored)
  • Method Details

    • getPlayer

      public org.bukkit.entity.Player getPlayer()
      Get the player who consumed the food.
    • getItem

      public org.bukkit.inventory.ItemStack getItem()
      Get the food item that was consumed. Note: This is a snapshot, modifying it won't affect the already-consumed item.
    • getCustomItemId

      public String getCustomItemId()
      Get the custom item ID if this was a Heirloom item. Returns null for vanilla foods.
    • isCustomItem

      public boolean isCustomItem()
      Check if this was a Heirloom custom food item.
    • getHungerRestored

      public int getHungerRestored()
      Get the hunger points restored (0-20 scale).
    • setHungerRestored

      public void setHungerRestored(int hunger)
      Set the hunger points to restore.
    • getSaturationRestored

      public float getSaturationRestored()
      Get the saturation restored.
    • setSaturationRestored

      public void setSaturationRestored(float saturation)
      Set the saturation to restore.
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
    • setCancelled

      public void setCancelled(boolean cancelled)
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
    • getHandlers

      public org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class org.bukkit.event.Event
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()