Skip to content

ServerListPingEvent

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

public ref struct ServerListPingEvent : IEvent

A client asked for the server list status. Change the MOTD, the player counts or hide the player sample.

Id 100
Key mc:server_list_ping
Cancellable no
Fired by the engine yes
Field Type Handlers may write Description
Connection ulong no (readonly) Connection id.
Address Utf8String no (readonly) Client address.
ProtocolVersion int no (readonly) Protocol version the client announced.
Motd component yes The message of the day.
MaxPlayers int yes Maximum player count shown.
OnlinePlayers int yes Online player count shown.
HidePlayers bool yes Do not send the player sample.
Member Description
Constructor Creates the event (for firing it from a plugin; native code builds its own).
public ServerListPingEvent(ulong connection, Utf8String address, int protocolVersion, Utf8String motd, int maxPlayers, int onlinePlayers, bool hidePlayers)

Creates the event (for firing it from a plugin; native code builds its own). Signature of API 1.0.

Parameters

Name Type Description
connection ulong
address Utf8String
protocolVersion int
motd Utf8String
maxPlayers int
onlinePlayers int
hidePlayers bool
Member Description
Utf8String Address { get; } Client address.
ulong Connection { get; } Connection id.
bool HidePlayers { get; set; } Do not send the player sample.
int MaxPlayers { get; set; } Maximum player count shown.
Component Motd { get; } The message of the day.
Utf8String MotdJson { get; } The message of the day.
int OnlinePlayers { get; set; } Online player count shown.
int ProtocolVersion { get; } Protocol version the client announced.
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 Utf8String Address { get; }

Client address.

public ulong Connection { get; }

Connection id.

public bool HidePlayers { get; set; }

Do not send the player sample.

public int MaxPlayers { get; set; }

Maximum player count shown.

public Component Motd { get; }

The message of the day. (parsed on access; allocates).

public Utf8String MotdJson { get; }

The message of the day. as JSON text (borrowed).

public int OnlinePlayers { get; set; }

Online player count shown.

public int ProtocolVersion { get; }

Protocol version the client announced.

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 SetMotd(Component value) Replaces ServerListPingEvent.Motd; an empty component clears it where the event says so.
public void SetMotd(Component value)

Replaces ServerListPingEvent.Motd; an empty component clears it where the event says so.

Parameters

Name Type Description
value Component

Component · IEvent · Utf8String