PlayerGameModeChangeEvent
Namespace Mc.Scripting.Events · Kind struct (ref)
public ref struct PlayerGameModeChangeEvent : IEventA player’s game mode is about to change. Cancel to keep the old one.
| Id | 123 |
| Key | mc:player_game_mode_change |
| Cancellable | yes |
| Fired by the engine | yes |
| Field | Type | Handlers may write | Description |
|---|---|---|---|
Player |
player |
no (readonly) | The player. |
OldMode |
enum:GameMode |
no (readonly) | The current mode. |
NewMode |
enum:GameMode |
no (readonly) | The new mode. |
Cause |
enum:GameModeChangeCause |
no (readonly) | Why. |
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 PlayerGameModeChangeEvent(Player player, GameMode oldMode, GameMode newMode, GameModeChangeCause cause)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 |
|
oldMode |
GameMode |
|
newMode |
GameMode |
|
cause |
GameModeChangeCause |
Properties
Section titled “Properties”| Member | Description |
|---|---|
bool Cancelled { get; set; } |
Cancelling stops lower-priority handlers (unless they opt in) and the action itself. |
GameModeChangeCause Cause { get; } |
Why. |
GameMode NewMode { get; } |
The new mode. |
GameMode OldMode { get; } |
The current mode. |
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 GameModeChangeCause Cause { get; }Why.
NewMode
Section titled “NewMode”public GameMode NewMode { get; }The new mode.
OldMode
Section titled “OldMode”public GameMode OldMode { get; }The current mode.
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.