Skip to content

PlayerGameModeChangeEvent

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

public ref struct PlayerGameModeChangeEvent : IEvent

A 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.

Member Description
Constructor Creates the event (for firing it from a plugin; native code builds its own).
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
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.
public bool Cancelled { get; set; }

Cancelling stops lower-priority handlers (unless they opt in) and the action itself.

public GameModeChangeCause Cause { get; }

Why.

public GameMode NewMode { get; }

The new mode.

public GameMode OldMode { get; }

The current mode.

public Player Player { get; }

The player.

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.

GameMode · GameModeChangeCause · IEvent · Player