Skip to content

PlayerItemHeldEvent

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

public ref struct PlayerItemHeldEvent : IEvent

A player selected another hotbar slot. Cancel to revert the selection.

Id 113
Key mc:player_item_held
Cancellable yes
Fired by the engine yes
Field Type Handlers may write Description
Player player no (readonly) The player.
PreviousSlot int no (readonly) Hotbar slot before (0-8).
NewSlot int no (readonly) Hotbar slot selected (0-8).

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

Member Description
PlayerItemHeldEvent(Player player, int previousSlot, int newSlot) Creates the event (for firing it from a plugin; native code builds its own).
public PlayerItemHeldEvent(Player player, int previousSlot, int newSlot)

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
previousSlot int
newSlot int
Member Description
bool Cancelled { get; set; } Cancelling stops lower-priority handlers (unless they opt in) and the action itself.
int NewSlot { get; } Hotbar slot selected (0-8).
Player Player { get; } The player.
int PreviousSlot { get; } Hotbar slot before (0-8).
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 int NewSlot { get; }

Hotbar slot selected (0-8).

public Player Player { get; }

The player.

public int PreviousSlot { get; }

Hotbar slot before (0-8).

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 · Player