Package org.bukkit.event.player
Class PlayerItemConsumeEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
org.bukkit.event.player.PlayerItemConsumeEvent
- All Implemented Interfaces:
- Cancellable
This event will fire when a player is finishing consuming an item (food,
 potion, milk bucket).
 
If the ItemStack is modified the server will use the effects of the new item and not remove the original one from the player's inventory.
If the event is cancelled the effect will not be applied and the item will not be removed from the player's inventory.
If the ItemStack is modified the server will use the effects of the new item and not remove the original one from the player's inventory.
If the event is cancelled the effect will not be applied and the item will not be removed from the player's inventory.
- 
Nested Class SummaryNested classes/interfaces inherited from class org.bukkit.event.EventEvent.Result
- 
Field SummaryFields inherited from class org.bukkit.event.player.PlayerEventplayer
- 
Constructor SummaryConstructorsConstructorDescriptionPlayerItemConsumeEvent(Player player, ItemStack item) Deprecated.PlayerItemConsumeEvent(Player player, ItemStack item, EquipmentSlot hand) 
- 
Method SummaryModifier and TypeMethodDescriptiongetHand()Get the hand used to consume the item.static HandlerListgetItem()Gets the item that is being consumed.booleanGets the cancellation state of this event.voidsetCancelled(boolean cancel) Sets the cancellation state of this event.voidSet the item being consumedMethods inherited from class org.bukkit.event.player.PlayerEventgetPlayerMethods inherited from class org.bukkit.event.EventgetEventName, isAsynchronous
- 
Constructor Details- 
PlayerItemConsumeEventpublic PlayerItemConsumeEvent(@NotNull Player player, @NotNull ItemStack item, @NotNull EquipmentSlot hand) - Parameters:
- player- the player consuming
- item- the ItemStack being consumed
- hand- the hand that was used
 
- 
PlayerItemConsumeEvent@Deprecated(since="1.19.2") public PlayerItemConsumeEvent(@NotNull Player player, @NotNull ItemStack item) Deprecated.- Parameters:
- player- the player consuming
- item- the ItemStack being consumed
 
 
- 
- 
Method Details- 
getItemGets the item that is being consumed. Modifying the returned item will have no effect, you must usesetItem(org.bukkit.inventory.ItemStack)instead.- Returns:
- an ItemStack for the item being consumed
 
- 
setItemSet the item being consumed- Parameters:
- item- the item being consumed
 
- 
getHandGet the hand used to consume the item.- Returns:
- the hand
 
- 
isCancelledpublic boolean isCancelled()Description copied from interface:CancellableGets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins- Specified by:
- isCancelledin interface- Cancellable
- Returns:
- true if this event is cancelled
 
- 
setCancelledpublic void setCancelled(boolean cancel) Description copied from interface:CancellableSets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.- Specified by:
- setCancelledin interface- Cancellable
- Parameters:
- cancel- true if you wish to cancel this event
 
- 
getHandlers- Specified by:
- getHandlersin class- Event
 
- 
getHandlerList
 
- 
PlayerItemConsumeEvent(Player, ItemStack, EquipmentSlot)