MenuClickEvent
Namespace Mc.Scripting.Events · Kind struct (ref)
public ref struct MenuClickEvent : IEventA player clicked in a custom GUI (Menu) of a plugin, after InventoryClick. Menus are locked: the click is denied (the client is resynced) unless a handler sets Allow, and a cancel always denies it. A click that could move items out of or into the menu (a slot of the menu, shift click, double click, drag, number key, off hand key) is delivered here with the slot of the menu’s own numbering (top slots first, then the player’s 27 + 9 slots).
| Id | 270 |
| Key | mc:menu_click |
| Cancellable | yes |
| Fired by the engine | yes |
| Field | Type | Handlers may write | Description |
|---|---|---|---|
Player |
player |
no (readonly) | The player. |
Menu |
int |
no (readonly) | The native id of the menu (what Menu uses to route the click). |
Slot |
int |
no (readonly) | The clicked slot, -999 outside the window. |
ClickType |
enum:ClickType |
no (readonly) | How it was clicked. |
Button |
int |
no (readonly) | Raw button of the packet. |
Clicked |
item |
no (readonly) | The item in the clicked slot. |
Cursor |
item |
no (readonly) | The item on the cursor. |
Allow |
bool |
yes | Set by a handler to let the click change items like in a chest (default false: the menu is a display). |
Set e.Cancelled = true in a handler to cancel it; lower-priority handlers are skipped unless they subscribed with receiveCancelled: true.
Constructors
Section titled “Constructors”| Member | Description |
|---|---|
Constructor |
Creates the event (for firing it from a plugin; native code builds its own). |
Constructor
Section titled “Constructor”public MenuClickEvent(Player player, int menu, int slot, ClickType clickType, int button, ItemView clicked, ItemView cursor, bool allow)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 |
|
menu |
int |
|
slot |
int |
|
clickType |
ClickType |
|
button |
int |
|
clicked |
ItemView |
|
cursor |
ItemView |
|
allow |
bool |
Properties
Section titled “Properties”| Member | Description |
|---|---|
bool Allow { get; set; } |
Set by a handler to let the click change items like in a chest (default false: the menu is a display). |
int Button { get; } |
Raw button of the packet. |
bool Cancelled { get; set; } |
Cancelling stops lower-priority handlers (unless they opt in) and the action itself. |
ClickType ClickType { get; } |
How it was clicked. |
ItemView Clicked { get; } |
The item in the clicked slot. |
ItemView Cursor { get; } |
The item on the cursor. |
int Menu { get; } |
The native id of the menu (what Menu uses to route the click). |
Player Player { get; } |
The player. |
int Slot { get; } |
The clicked slot, -999 outside the window. |
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 Allow { get; set; }Set by a handler to let the click change items like in a chest (default false: the menu is a display).
Button
Section titled “Button”public int Button { get; }Raw button of the packet.
Cancelled
Section titled “Cancelled”public bool Cancelled { get; set; }Cancelling stops lower-priority handlers (unless they opt in) and the action itself.
ClickType
Section titled “ClickType”public ClickType ClickType { get; }How it was clicked.
Clicked
Section titled “Clicked”public ItemView Clicked { get; }The item in the clicked slot.
Cursor
Section titled “Cursor”public ItemView Cursor { get; }The item on the cursor.
public int Menu { get; }The native id of the menu (what Menu uses to route the click).
Player
Section titled “Player”public Player Player { get; }The player.
public int Slot { get; }The clicked slot, -999 outside the window.
CatalogueId
Section titled “CatalogueId”public static ushort CatalogueId { get; }Catalogue id (stable ABI).
IsCancellable
Section titled “IsCancellable”public static bool IsCancellable { get; }Whether handlers can cancel the event.
public static string Key { get; }Registry key of the event.