Skip to content

PlayerKickEvent

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

public ref struct PlayerKickEvent : IEvent

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

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

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

public Component LeaveMessage { get; }

The message broadcast to everybody (empty = the default quit message). (parsed on access; allocates).

public Utf8String LeaveMessageJson { get; }

The message broadcast to everybody (empty = the default quit message). as JSON text (borrowed).

public Player Player { get; }

The player.

public Component Reason { get; }

The disconnect screen text. (parsed on access; allocates).

public Utf8String ReasonJson { get; }

The disconnect screen text. as JSON text (borrowed).

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 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.
public void SetLeaveMessage(Component value)

Replaces PlayerKickEvent.LeaveMessage; an empty component clears it where the event says so.

Parameters

Name Type Description
value Component
public void SetReason(Component value)

Replaces PlayerKickEvent.Reason; an empty component clears it where the event says so.

Parameters

Name Type Description
value Component

Component · IEvent · Player · Utf8String