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
ConstructorsConstructorDescriptionHeirloomFoodConsumedEvent(org.bukkit.entity.Player player, org.bukkit.inventory.ItemStack item, String customItemId, int hungerRestored, float saturationRestored) -
Method Summary
Modifier and TypeMethodDescriptionGet the custom item ID if this was a Heirloom item.static org.bukkit.event.HandlerListorg.bukkit.event.HandlerListintGet the hunger points restored (0-20 scale).org.bukkit.inventory.ItemStackgetItem()Get the food item that was consumed.org.bukkit.entity.PlayerGet the player who consumed the food.floatGet the saturation restored.booleanbooleanCheck if this was a Heirloom custom food item.voidsetCancelled(boolean cancelled) voidsetHungerRestored(int hunger) Set the hunger points to restore.voidsetSaturationRestored(float saturation) Set the saturation to restore.Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
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
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:
isCancelledin interfaceorg.bukkit.event.Cancellable
-
setCancelled
public void setCancelled(boolean cancelled) - Specified by:
setCancelledin interfaceorg.bukkit.event.Cancellable
-
getHandlers
public org.bukkit.event.HandlerList getHandlers()- Specified by:
getHandlersin classorg.bukkit.event.Event
-
getHandlerList
public static org.bukkit.event.HandlerList getHandlerList()
-