Class endstone::PlayerItemConsumeEvent¶
ClassList > endstone > PlayerItemConsumeEvent
Called when a player is finishing consuming an item (food, potion, milk bucket). More...
- #include <endstone/event/player/player_item_consume_event.h>
Inherits the following classes: endstone::Cancellable
Public Functions¶
| Type | Name | 
|---|---|
| PlayerItemConsumeEvent (Player & player, const ItemStack & item, EquipmentSlot hand) | |
| EquipmentSlot | getHand () const Get the hand used to consume the item. | 
| std::unique_ptr< ItemStack > | getItem () const Gets the item that is being consumed. | 
Public Functions inherited from endstone::Cancellable¶
| Type | Name | 
|---|---|
| virtual void | cancel () Cancel this event. A cancelled event will not be executed in the server, but will still pass to other plugins. | 
| virtual bool | isCancelled () override const Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins. | 
| virtual void | setCancelled (bool cancel) override Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins. | 
Public Functions inherited from endstone::ICancellable¶
| Type | Name | 
|---|---|
| virtual void | cancel () = 0 | 
| virtual bool | isCancelled () const = 0 | 
| virtual void | setCancelled (bool cancel) = 0 | 
| virtual | ~ICancellable () = default | 
Detailed Description¶
Note:
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.
Note:
If the event is cancelled the effect will not be applied and the item will not be removed from the player's inventory.
Public Functions Documentation¶
function PlayerItemConsumeEvent¶
inline explicit endstone::PlayerItemConsumeEvent::PlayerItemConsumeEvent (
    Player & player,
    const ItemStack & item,
    EquipmentSlot hand
) 
function getHand¶
Get the hand used to consume the item.
Returns:
the hand
function getItem¶
Gets the item that is being consumed.
Note:
Modifying the returned item will have no effect, you must use setItem(ItemStack) instead.
Returns:
an ItemStack for the item being consumed
The documentation for this class was generated from the following file include/endstone/event/player/player_item_consume_event.h