ServerListPingEventand modify the
ResponseDatain the event. Regardless of the source of the ping, the response data will be formatted in the correct way for the corrosponding source.
ServerListPingTypeenum. The type can be obtained from the
getPingType()method. This allows you to change your responses based on the incoming ping, allowing you to only fill in the information that is needed or customise the response based on the type of ping.
ServerListPingEventcan be broken down into three different categories.
MODERN_NAMED_COLORSconstants, this category represents the most common type of response and is used on Minecraft versions 1.7 and higher. This includes the name, protocol, version, description, favicon, number of players online, max number of players online and a sample of the online players.
NamedAndIdentifiedinterface is used to hold this mapping and allow both players and custom mappings to be used interchangeably in the
ResponseDataclass. For an example on how to use this interface, see the code block below.
LEGACY_UNVERSIONEDconstants, this category represents server list pings that are sent by clients on version 1.6 or lower. These ping types only support the description and the current/max number of players. The
LEGACY_VERSIONEDtype additionally supports the version of the server.
OPEN_TO_LANconstant, this category represents server list pings that are sent from the server when it is mimicking being a single player world that is opened to LAN. This type only supports the description. As with the legacy type, the description is formatted using legacy section sign color coding and is automatically converted to this format.
ServerListPingEvent, the underlying