Class QueryResponse.Builder

java.lang.Object
com.velocitypowered.api.proxy.server.QueryResponse.Builder
Enclosing class:
QueryResponse

public static final class QueryResponse.Builder extends Object
A builder for QueryResponse objects.
  • Method Details

    • hostname

      public QueryResponse.Builder hostname(String hostname)
      Sets the hostname for the response.
      Parameters:
      hostname - the hostname to set
      Returns:
      this builder, for chaining
    • gameVersion

      public QueryResponse.Builder gameVersion(String gameVersion)
      Sets the game version for the response.
      Parameters:
      gameVersion - the game version to set
      Returns:
      this builder, for chaining
    • map

      public QueryResponse.Builder map(String map)
      Sets the map that will appear in the response.
      Parameters:
      map - the map to set
      Returns:
      this builder, for chaining
    • currentPlayers

      public QueryResponse.Builder currentPlayers(int currentPlayers)
      Sets the players that are currently claimed to be online.
      Parameters:
      currentPlayers - a non-negative number representing all players online
      Returns:
      this builder, for chaining
    • maxPlayers

      public QueryResponse.Builder maxPlayers(int maxPlayers)
      Sets the maximum number of players this server purportedly can hold.
      Parameters:
      maxPlayers - a non-negative number representing the maximum number of builders
      Returns:
      this builder, for chaining
    • proxyHost

      public QueryResponse.Builder proxyHost(String proxyHost)
      Sets the host where this proxy is running.
      Parameters:
      proxyHost - the host where the proxy is running
      Returns:
      this instance, for chaining
    • proxyPort

      public QueryResponse.Builder proxyPort(int proxyPort)
      Sets the port where this proxy is running.
      Parameters:
      proxyPort - the port where the proxy is running
      Returns:
      this instance, for chaining
    • players

      public QueryResponse.Builder players(Collection<String> players)
      Adds the specified players to the player list.
      Parameters:
      players - the players to add
      Returns:
      this builder, for chaining
    • players

      public QueryResponse.Builder players(String... players)
      Adds the specified players to the player list.
      Parameters:
      players - the players to add
      Returns:
      this builder, for chaining
    • clearPlayers

      public QueryResponse.Builder clearPlayers()
      Removes all players from the builder. This does not affect QueryResponse.getCurrentPlayers().
      Returns:
      this builder, for chaining
    • proxyVersion

      public QueryResponse.Builder proxyVersion(String proxyVersion)
      Sets the proxy version.
      Parameters:
      proxyVersion - the proxy version to set
      Returns:
      this builder, for chaining
    • plugins

      Adds the specified plugins to the plugins list.
      Parameters:
      plugins - the plugins to add
      Returns:
      this builder, for chaining
    • plugins

      Adds the specified plugins to the plugins list.
      Parameters:
      plugins - the plugins to add
      Returns:
      this builder, for chaining
    • clearPlugins

      public QueryResponse.Builder clearPlugins()
      Clears all currently set plugins.
      Returns:
      this builder, for chaining
    • build

      public QueryResponse build()
      Builds a new QueryResponse with the supplied data. The current instance can be reused after this method is called.
      Returns:
      response