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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addEntries
(@NotNull Collection<? extends NamedAndIdentified> entries) Adds a series of entries to the response data sample.void
addEntries
(@NotNull NamedAndIdentified... entries) Adds a series of entries to the response data sample.void
addEntry
(@NotNull NamedAndIdentified entry) Adds an entry to the response data sample.boolean
Returns if the players are hidden or not.void
Clears the entries.Get the response description@NotNull Collection
<NamedAndIdentified> Gets a modifiable collection of the current entries.Get the response favicon.int
Get the response maximum player count.int
Get the response online count.int
Get the response protocol version.Get the version name for the response.void
setDescription
(Component description) Sets the response description.void
setFavicon
(String favicon) Sets the response favicon.void
setMaxPlayer
(int maxPlayer) Sets the response maximum player count.void
setOnline
(int online) Sets the response online count.void
setPlayersHidden
(boolean playersHidden) Sets whether the players are hidden or not.void
setProtocol
(int protocol) Sets the response protocol version.void
setVersion
(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
-