PlayerQuitEvent
Namespace Mc.Scripting.Events · Kind struct (ref)
public ref struct PlayerQuitEvent : IEventA 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). |
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 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 |
Properties
Section titled “Properties”| 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. |
Player
Section titled “Player”public Player Player { get; }The player.
QuitMessage
Section titled “QuitMessage”public Component QuitMessage { get; }The message broadcast to everybody (set to an empty component to suppress it). (parsed on access; allocates).
QuitMessageJson
Section titled “QuitMessageJson”public Utf8String QuitMessageJson { get; }The message broadcast to everybody (set to an empty component to suppress it). as JSON text (borrowed).
Reason
Section titled “Reason”public Utf8String Reason { get; }Why the connection ended: disconnected, kicked, timeout, protocol_error, connection_lost or server_shutdown.
Username
Section titled “Username”public Utf8String Username { get; }The profile name.
public Uuid Uuid { get; }The profile id.
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.
Methods
Section titled “Methods”| Member | Description |
|---|---|
void SetQuitMessage(Component value) |
Replaces PlayerQuitEvent.QuitMessage; an empty component clears it where the event says so. |
SetQuitMessage
Section titled “SetQuitMessage”public void SetQuitMessage(Component value)Replaces PlayerQuitEvent.QuitMessage; an empty component clears it where the event says so.
Parameters
| Name | Type | Description |
|---|---|---|
value |
Component |
See also
Section titled “See also”Component · IEvent · Player · Utf8String · Uuid