Skip to content

PlayerQuitEvent

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

public ref struct PlayerQuitEvent : IEvent

A player disconnected (the entity is still alive during dispatch).

Id 12
Key mc:player_quit
Cancellable no
Fired by the engine yes
Field Type Handlers may write Description
Player player no (readonly) The player.
Uuid Uuid no (readonly) The profile id.
Username Utf8String no (readonly) The profile name.
Reason Utf8String no (readonly) Why the connection ended: disconnected, kicked, timeout, protocol_error, connection_lost or server_shutdown.
QuitMessage component yes The message broadcast to everybody (set to an empty component to suppress it).
Member Description
Constructor Creates the event (for firing it from a plugin; native code builds its own).
public PlayerQuitEvent(Player player, Uuid uuid, Utf8String username, Utf8String reason, Utf8String quitMessage)

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
uuid Uuid
username Utf8String
reason Utf8String
quitMessage Utf8String
Member Description
Player Player { get; } The player.
Component QuitMessage { get; } The message broadcast to everybody (set to an empty component to suppress it).
Utf8String QuitMessageJson { get; } The message broadcast to everybody (set to an empty component to suppress it).
Utf8String Reason { get; } Why the connection ended: disconnected, kicked, timeout, protocol_error, connection_lost or server_shutdown.
Utf8String Username { get; } The profile name.
Uuid Uuid { get; } The profile id.
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 Player Player { get; }

The player.

public Component QuitMessage { get; }

The message broadcast to everybody (set to an empty component to suppress it). (parsed on access; allocates).

public Utf8String QuitMessageJson { get; }

The message broadcast to everybody (set to an empty component to suppress it). as JSON text (borrowed).

public Utf8String Reason { get; }

Why the connection ended: disconnected, kicked, timeout, protocol_error, connection_lost or server_shutdown.

public Utf8String Username { get; }

The profile name.

public Uuid Uuid { get; }

The profile id.

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.

Member Description
void SetQuitMessage(Component value) Replaces PlayerQuitEvent.QuitMessage; an empty component clears it where the event says so.
public void SetQuitMessage(Component value)

Replaces PlayerQuitEvent.QuitMessage; an empty component clears it where the event says so.

Parameters

Name Type Description
value Component

Component · IEvent · Player · Utf8String · Uuid