ServerListPingEvent
Namespace Mc.Scripting.Events · Kind struct (ref)
public ref struct ServerListPingEvent : IEventA 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. |
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 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 |
Properties
Section titled “Properties”| 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. |
Address
Section titled “Address”public Utf8String Address { get; }Client address.
Connection
Section titled “Connection”public ulong Connection { get; }Connection id.
HidePlayers
Section titled “HidePlayers”public bool HidePlayers { get; set; }Do not send the player sample.
MaxPlayers
Section titled “MaxPlayers”public int MaxPlayers { get; set; }Maximum player count shown.
public Component Motd { get; }The message of the day. (parsed on access; allocates).
MotdJson
Section titled “MotdJson”public Utf8String MotdJson { get; }The message of the day. as JSON text (borrowed).
OnlinePlayers
Section titled “OnlinePlayers”public int OnlinePlayers { get; set; }Online player count shown.
ProtocolVersion
Section titled “ProtocolVersion”public int ProtocolVersion { get; }Protocol version the client announced.
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 SetMotd(Component value) |
Replaces ServerListPingEvent.Motd; an empty component clears it where the event says so. |
SetMotd
Section titled “SetMotd”public void SetMotd(Component value)Replaces ServerListPingEvent.Motd; an empty component clears it where the event says so.
Parameters
| Name | Type | Description |
|---|---|---|
value |
Component |