Enum Class ServerListPingType

java.lang.Object
java.lang.Enum<ServerListPingType>
net.minestom.server.ping.ServerListPingType
All Implemented Interfaces:
Serializable, Comparable<ServerListPingType>, Constable

public enum ServerListPingType extends Enum<ServerListPingType>
An enum containing the different types of server list ping responses.
See Also:
  • Enum Constant Details

    • MODERN_FULL_RGB

      public static final ServerListPingType MODERN_FULL_RGB
      The client is on version 1.16 or higher and supports full RGB with JSON text formatting.
    • MODERN_NAMED_COLORS

      public static final ServerListPingType 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

      public static final ServerListPingType LEGACY_VERSIONED
      The client is on version 1.6 and supports a description, the player count and the version information.
    • LEGACY_UNVERSIONED

      public static final ServerListPingType LEGACY_UNVERSIONED
      The client is on version 1.5 or lower and supports a description and the player count.
    • OPEN_TO_LAN

      public static final ServerListPingType OPEN_TO_LAN
      The ping that is sent when OpenToLAN 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

      public static ServerListPingType[] 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

      public static ServerListPingType valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • getPingResponse

      @NotNull public @NotNull String getPingResponse(@NotNull @NotNull ResponseData responseData)
      Gets the ping response for this version.
      Parameters:
      responseData - the response data
      Returns:
      the response
    • getOpenToLANPing

      @NotNull public static @NotNull String getOpenToLANPing(@NotNull @NotNull ResponseData data)
      Creates a ping sent when the server is sending OpenToLAN 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 data
      supportsVersions - 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 data
      supportsFullRgb - if the client supports full RGB
      Returns:
      the response
    • fromModernProtocolVersion

      @NotNull public static @NotNull ServerListPingType fromModernProtocolVersion(int version)
      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