PlayerKickEvent
Namespace Mc.Scripting.Events · Kind struct (ref)
public ref struct PlayerKickEvent : IEventA player is about to be kicked by a command or plugin. Cancel to keep the player. Not fired for protocol errors or disconnects.
| Id | 110 |
| Key | mc:player_kick |
| Cancellable | yes |
| Fired by the engine | yes |
| Field | Type | Handlers may write | Description |
|---|---|---|---|
Player |
player |
no (readonly) | The player. |
Reason |
component |
yes | The disconnect screen text. |
LeaveMessage |
component |
yes | The message broadcast to everybody (empty = the default quit message). |
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 |
|---|---|
PlayerKickEvent(Player player, Utf8String reason, Utf8String leaveMessage) |
Creates the event (for firing it from a plugin; native code builds its own). |
Constructor
Section titled “Constructor”public PlayerKickEvent(Player player, Utf8String reason, Utf8String leaveMessage)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 |
|
reason |
Utf8String |
|
leaveMessage |
Utf8String |
Properties
Section titled “Properties”| Member | Description |
|---|---|
bool Cancelled { get; set; } |
Cancelling stops lower-priority handlers (unless they opt in) and the action itself. |
Component LeaveMessage { get; } |
The message broadcast to everybody (empty = the default quit message). |
Utf8String LeaveMessageJson { get; } |
The message broadcast to everybody (empty = the default quit message). |
Player Player { get; } |
The player. |
Component Reason { get; } |
The disconnect screen text. |
Utf8String ReasonJson { get; } |
The disconnect screen text. |
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.
LeaveMessage
Section titled “LeaveMessage”public Component LeaveMessage { get; }The message broadcast to everybody (empty = the default quit message). (parsed on access; allocates).
LeaveMessageJson
Section titled “LeaveMessageJson”public Utf8String LeaveMessageJson { get; }The message broadcast to everybody (empty = the default quit message). as JSON text (borrowed).
Player
Section titled “Player”public Player Player { get; }The player.
Reason
Section titled “Reason”public Component Reason { get; }The disconnect screen text. (parsed on access; allocates).
ReasonJson
Section titled “ReasonJson”public Utf8String ReasonJson { get; }The disconnect screen text. as JSON text (borrowed).
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 SetLeaveMessage(Component value) |
Replaces PlayerKickEvent.LeaveMessage; an empty component clears it where the event says so. |
void SetReason(Component value) |
Replaces PlayerKickEvent.Reason; an empty component clears it where the event says so. |
SetLeaveMessage
Section titled “SetLeaveMessage”public void SetLeaveMessage(Component value)Replaces PlayerKickEvent.LeaveMessage; an empty component clears it where the event says so.
Parameters
| Name | Type | Description |
|---|---|---|
value |
Component |
SetReason
Section titled “SetReason”public void SetReason(Component value)Replaces PlayerKickEvent.Reason; 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