Class ResponseData

java.lang.Object
net.minestom.server.ping.ResponseData

public class ResponseData extends Object
Represents the data sent to the player when responding to a ping event.
See Also:
  • Constructor Details

    • ResponseData

      public ResponseData()
      Constructs a new ResponseData.
  • Method Details

    • setName

      @Deprecated public void setName(String name)
      Deprecated.
      This is named incorrectly, use setVersion(String) instead
      Sets the name for the response.
      Parameters:
      name - The name for the response data.
    • setVersion

      public void setVersion(String version)
      Sets the version name for the response.
      Parameters:
      version - The version name for the response data.
    • getVersion

      public String 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 public void addPlayer(Iterable<Player> players)
      Deprecated.
      Adds some players to the response.
      Parameters:
      players - the players
    • addPlayer

      @Deprecated public void addPlayer(Player player)
      Adds a player to the response.
      Parameters:
      player - the player
    • addPlayer

      @Deprecated public void addPlayer(String name, UUID uuid)
      Adds a player to the response.
      Parameters:
      name - The name of the player.
      uuid - The unique identifier of the player.
    • addPlayer

      @Deprecated public void addPlayer(String name)
      Adds a player to the response.

      UUID.randomUUID() is used as the player's UUID.

      Parameters:
      name - The name of the player.
    • clearPlayers

      @Deprecated public void clearPlayers()
      Deprecated.
      Removes all of the ping players from this entries. The entries list will be empty this call returns.
    • getPlayers

      @Deprecated(forRemoval=true) public List<ResponseData.PingPlayer> getPlayers()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getEntries(). 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 public void setDescription(String description)
      Deprecated.
      Sets the response description.
      Parameters:
      description - The description for the response data.
    • setDescription

      public void setDescription(Component description)
      Sets the response description.
      Parameters:
      description - The description for the response data.
    • getDescription

      public Component getDescription()
      Get the response description
      Returns:
      the response description
    • setFavicon

      public void setFavicon(String favicon)
      Sets the response favicon.

      MUST start with "data:image/png;base64,"

      Parameters:
      favicon - The favicon for the response data.
    • getFavicon

      public String getFavicon()
      Get the response favicon.
      Returns:
      the response favicon.
    • addEntry

      public void addEntry(@NotNull @NotNull NamedAndIdentified entry)
      Adds an entry to the response data sample. This can be a player or a custom object.
      Parameters:
      entry - the entry
      See Also:
    • addEntries

      public void addEntries(@NotNull @NotNull NamedAndIdentified... entries)
      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

      public void addEntries(@NotNull @NotNull Collection<? extends NamedAndIdentified> entries)
      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

      @NotNull public @NotNull Collection<NamedAndIdentified> 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 @NotNull public @NotNull com.google.gson.JsonObject build()
      Converts the response data into a JsonObject.
      Returns:
      The converted response data as a json tree.