Package net.minestom.server.ping
Class ResponseData
java.lang.Object
net.minestom.server.ping.ResponseData
Represents the data sent to the player when responding to a ping event.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEntries(@NotNull Collection<? extends NamedAndIdentified> entries) Adds a series of entries to the response data sample.voidaddEntries(@NotNull NamedAndIdentified... entries) Adds a series of entries to the response data sample.voidaddEntry(@NotNull NamedAndIdentified entry) Adds an entry to the response data sample.booleanReturns if the players are hidden or not.voidClears the entries.Get the response description@NotNull Collection<NamedAndIdentified> Gets a modifiable collection of the current entries.Get the response favicon.intGet the response maximum player count.intGet the response online count.intGet the response protocol version.Get the version name for the response.voidsetDescription(Component description) Sets the response description.voidsetFavicon(String favicon) Sets the response favicon.voidsetMaxPlayer(int maxPlayer) Sets the response maximum player count.voidsetOnline(int online) Sets the response online count.voidsetPlayersHidden(boolean playersHidden) Sets whether the players are hidden or not.voidsetProtocol(int protocol) Sets the response protocol version.voidsetVersion(String version) Sets the version name for the response.
-
Constructor Details
-
ResponseData
public ResponseData()Constructs a newResponseData.
-
-
Method Details
-
setVersion
Sets the version name for the response.- Parameters:
version- The version name for the response data.
-
getVersion
Get the version name for the response.- Returns:
- the version name for the response.
-
setProtocol
public void setProtocol(int protocol) Sets the response protocol version.- Parameters:
protocol- The protocol version for the response data.
-
getProtocol
public int getProtocol()Get the response protocol version.- Returns:
- the response protocol version.
-
setMaxPlayer
public void setMaxPlayer(int maxPlayer) Sets the response maximum player count.- Parameters:
maxPlayer- The maximum player count for the response data.
-
getMaxPlayer
public int getMaxPlayer()Get the response maximum player count.- Returns:
- the response maximum player count.
-
setOnline
public void setOnline(int online) Sets the response online count.- Parameters:
online- The online count for the response data.
-
getOnline
public int getOnline()Get the response online count.- Returns:
- the response online count.
-
setDescription
Sets the response description.- Parameters:
description- The description for the response data.
-
getDescription
Get the response description- Returns:
- the response description
-
setFavicon
Sets the response favicon.MUST start with "data:image/png;base64,"
- Parameters:
favicon- The favicon for the response data.
-
getFavicon
Get the response favicon.- Returns:
- the response favicon.
-
addEntry
Adds an entry to the response data sample. This can be a player or a custom object.- Parameters:
entry- the entry- See Also:
-
addEntries
Adds a series of entries to the response data sample. These can be players or a custom object.- Parameters:
entries- the entries- See Also:
-
addEntries
Adds a series of entries to the response data sample. These can be players or a custom object.- Parameters:
entries- the entries- See Also:
-
clearEntries
public void clearEntries()Clears the entries. -
getEntries
Gets a modifiable collection of the current entries.- Returns:
- the entries
-
setPlayersHidden
public void setPlayersHidden(boolean playersHidden) Sets whether the players are hidden or not. In the vanilla client, `???` will be displayed where the online and maximum players would be.- Parameters:
playersHidden- if the players are hidden
-
arePlayersHidden
public boolean arePlayersHidden()Returns if the players are hidden or not.- Returns:
- if the players are hidden
-