EnchantItemEvent
Namespace Mc.Scripting.Events · Kind struct (ref)
public ref struct EnchantItemEvent : IEventA player is enchanting an item at an enchanting table. Cancel to refuse.
| Id | 268 |
| Key | mc:enchant_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 being enchanted. |
Option |
int |
no (readonly) | The chosen option (0-2). |
Cost |
int |
no (readonly) | Levels charged. |
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 |
|---|---|
EnchantItemEvent(Player player, ItemView item, int option, int cost) |
Creates the event (for firing it from a plugin; native code builds its own). |
Constructor
Section titled “Constructor”public EnchantItemEvent(Player player, ItemView item, int option, int cost)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 |
|
option |
int |
|
cost |
int |
Properties
Section titled “Properties”| Member | Description |
|---|---|
bool Cancelled { get; set; } |
Cancelling stops lower-priority handlers (unless they opt in) and the action itself. |
int Cost { get; } |
Levels charged. |
ItemView Item { get; } |
The item being enchanted. |
int Option { get; } |
The chosen option (0-2). |
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. |
Cancelled
Section titled “Cancelled”public bool Cancelled { get; set; }Cancelling stops lower-priority handlers (unless they opt in) and the action itself.
public int Cost { get; }Levels charged.
public ItemView Item { get; }The item being enchanted.
Option
Section titled “Option”public int Option { get; }The chosen option (0-2).
Player
Section titled “Player”public Player Player { get; }The player.
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.