Package net.minestom.server.ping
Enum Class ServerListPingType
- All Implemented Interfaces:
Serializable
,Comparable<ServerListPingType>
,Constable
An enum containing the different types of server list ping responses.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionThe client is on version 1.5 or lower and supports a description and the player count.The client is on version 1.6 and supports a description, the player count and the version information.The client is on version 1.16 or higher and supports full RGB with JSON text formatting.The client is on version 1.7 or higher and doesn't support full RGB but does support JSON text formatting.The ping that is sent whenOpenToLAN
is enabled and sending packets. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ServerListPingType
fromModernProtocolVersion
(int version) Gets the server list ping version from the protocol version.static @NotNull String
getLegacyPingResponse
(@NotNull ResponseData data, boolean supportsVersions) Creates a legacy ping response for client versions below the Netty rewrite (1.6-).static @NotNull com.google.gson.JsonObject
getModernPingResponse
(@NotNull ResponseData data, boolean supportsFullRgb) Creates a modern ping response for client versions above the Netty rewrite (1.7+).static @NotNull String
getOpenToLANPing
(@NotNull ResponseData data) Creates a ping sent when the server is sendingOpenToLAN
packets.@NotNull String
getPingResponse
(@NotNull ResponseData responseData) Gets the ping response for this version.static ServerListPingType
Returns the enum constant of this class with the specified name.static ServerListPingType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
MODERN_FULL_RGB
The client is on version 1.16 or higher and supports full RGB with JSON text formatting. -
MODERN_NAMED_COLORS
The client is on version 1.7 or higher and doesn't support full RGB but does support JSON text formatting. -
LEGACY_VERSIONED
The client is on version 1.6 and supports a description, the player count and the version information. -
LEGACY_UNVERSIONED
The client is on version 1.5 or lower and supports a description and the player count. -
OPEN_TO_LAN
The ping that is sent whenOpenToLAN
is enabled and sending packets. Only the description formatted as a legacy string is sent. Ping events with this ping version are not cancellable.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
getPingResponse
Gets the ping response for this version.- Parameters:
responseData
- the response data- Returns:
- the response
-
getOpenToLANPing
Creates a ping sent when the server is sendingOpenToLAN
packets.- Parameters:
data
- the response data- Returns:
- the ping
- See Also:
-
getLegacyPingResponse
@NotNull public static @NotNull String getLegacyPingResponse(@NotNull @NotNull ResponseData data, boolean supportsVersions) Creates a legacy ping response for client versions below the Netty rewrite (1.6-).- Parameters:
data
- the response datasupportsVersions
- if the client supports recieving the versions of the server- Returns:
- the response
-
getModernPingResponse
@NotNull public static @NotNull com.google.gson.JsonObject getModernPingResponse(@NotNull @NotNull ResponseData data, boolean supportsFullRgb) Creates a modern ping response for client versions above the Netty rewrite (1.7+).- Parameters:
data
- the response datasupportsFullRgb
- if the client supports full RGB- Returns:
- the response
-
fromModernProtocolVersion
Gets the server list ping version from the protocol version. This only works for modern ping responses since the Netty rewrite.- Parameters:
version
- the protocol version- Returns:
- the corresponding server list ping version
-