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:
-
Nested Class Summary
-
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.void
Deprecated.void
Deprecated.void
Deprecated.void
Deprecated.boolean
Returns if the players are hidden or not.@NotNull com.google.gson.JsonObject
build()
Deprecated.void
Clears the entries.void
Deprecated.UseclearEntries()
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.Deprecated, for removal: This API element is subject to removal in a future version.UsegetEntries()
.int
Get the response protocol version.Get the version name for the response.void
setDescription
(String description) Deprecated.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
Deprecated.This is named incorrectly, usesetVersion(String)
insteadvoid
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
-
setName
Deprecated.This is named incorrectly, usesetVersion(String)
insteadSets the name for the response.- Parameters:
name
- The name for the response data.
-
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.
-
addPlayer
Deprecated.Adds some players to the response.- Parameters:
players
- the players
-
addPlayer
Deprecated.Adds a player to the response.- Parameters:
player
- the player
-
addPlayer
Deprecated.Adds a player to the response.- Parameters:
name
- The name of the player.uuid
- The unique identifier of the player.
-
addPlayer
Deprecated.Adds a player to the response.UUID.randomUUID()
is used as the player's UUID.- Parameters:
name
- The name of the player.
-
clearPlayers
Deprecated.UseclearEntries()
Removes all of the ping players from thisentries
. Theentries
list will be empty this call returns. -
getPlayers
Deprecated, for removal: This API element is subject to removal in a future version.UsegetEntries()
. This return value is now unmodifiable and this operation is incredibly costly.Get the list of the response players.- Returns:
- the list of the response players.
-
setDescription
Deprecated.Sets the response description.- Parameters:
description
- The description for the response data.
-
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
-
build
Deprecated.Converts the response data into aJsonObject
.- Returns:
- The converted response data as a json tree.
-
NamedAndIdentified