Skip to content

PlayerDropItemEvent

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

public ref struct PlayerDropItemEvent : IEvent

A player drops an item from the hotbar or inventory (drop key). Cancel to keep it.

Id 115
Key mc:player_drop_item
Cancellable yes
Fired by the engine yes
Field Type Handlers may write Description
Player player no (readonly) The player.
Item item no (readonly) The item (a single one, or the whole stack for the control-drop).
WholeStack bool no (readonly) Control-drop of the whole stack.

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

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

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
wholeStack bool
Member Description
bool Cancelled { get; set; } Cancelling stops lower-priority handlers (unless they opt in) and the action itself.
ItemView Item { get; } The item (a single one, or the whole stack for the control-drop).
Player Player { get; } The player.
bool WholeStack { get; } Control-drop of the whole stack.
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 ItemView Item { get; }

The item (a single one, or the whole stack for the control-drop).

public Player Player { get; }

The player.

public bool WholeStack { get; }

Control-drop of the whole stack.

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.

IEvent · ItemView · Player