Skip to content

PlayerConsumeEvent

Namespace Mc.Scripting.Events · Kind struct (ref)

public ref struct PlayerConsumeEvent : IEvent

A player finished eating or drinking. Cancel to prevent the effects and the item consumption.

Id 117
Key mc:player_consume
Cancellable yes
Fired by the engine yes
Field Type Handlers may write Description
Player player no (readonly) The player.
Item item no (readonly) The consumed item.
Hand enum:Hand no (readonly) The hand.

Set e.Cancelled = true in a handler to cancel it; lower-priority handlers are skipped unless they subscribed with receiveCancelled: true.

Member Description
PlayerConsumeEvent(Player player, ItemView item, Hand hand) Creates the event (for firing it from a plugin; native code builds its own).
public PlayerConsumeEvent(Player player, ItemView item, Hand hand)

Creates the event (for firing it from a plugin; native code builds its own). Signature of API 1.0.

Parameters

Name Type Description
player Player
item ItemView
hand Hand
Member Description
bool Cancelled { get; set; } Cancelling stops lower-priority handlers (unless they opt in) and the action itself.
Hand Hand { get; } The hand.
ItemView Item { get; } The consumed item.
Player Player { get; } The player.
static ushort CatalogueId { get; } Catalogue id (stable ABI).
static bool IsCancellable { get; } Whether handlers can cancel the event.
static string Key { get; } Registry key of the event.
public bool Cancelled { get; set; }

Cancelling stops lower-priority handlers (unless they opt in) and the action itself.

public Hand Hand { get; }

The hand.

public ItemView Item { get; }

The consumed item.

public Player Player { get; }

The player.

public static ushort CatalogueId { get; }

Catalogue id (stable ABI).

public static bool IsCancellable { get; }

Whether handlers can cancel the event.

public static string Key { get; }

Registry key of the event.

Hand · IEvent · ItemView · Player