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 forQueryResponseobjects.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QueryResponsebuild()Builds a newQueryResponsewith the supplied data.QueryResponse.BuilderclearPlayers()Removes all players from the builder.QueryResponse.BuilderclearPlugins()Clears all currently set plugins.QueryResponse.BuildercurrentPlayers(int currentPlayers)Sets the players that are currently claimed to be online.QueryResponse.BuildergameVersion(String gameVersion)Sets the game version for the response.QueryResponse.Builderhostname(String hostname)Sets the hostname for the response.QueryResponse.Buildermap(String map)Sets the map that will appear in the response.QueryResponse.BuildermaxPlayers(int maxPlayers)Sets the maximum number of players this server purportedly can hold.QueryResponse.Builderplayers(String... players)Adds the specified players to the player list.QueryResponse.Builderplayers(Collection<String> players)Adds the specified players to the player list.QueryResponse.Builderplugins(QueryResponse.PluginInformation... plugins)Adds the specified plugins to the plugins list.QueryResponse.Builderplugins(Collection<QueryResponse.PluginInformation> plugins)Adds the specified plugins to the plugins list.QueryResponse.BuilderproxyHost(String proxyHost)Sets the host where this proxy is running.QueryResponse.BuilderproxyPort(int proxyPort)Sets the port where this proxy is running.QueryResponse.BuilderproxyVersion(String proxyVersion)Sets the proxy version.
-
-
-
Method Detail
-
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 affectQueryResponse.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
public QueryResponse.Builder plugins(Collection<QueryResponse.PluginInformation> plugins)
Adds the specified plugins to the plugins list.- Parameters:
plugins- the plugins to add- Returns:
- this builder, for chaining
-
plugins
public QueryResponse.Builder plugins(QueryResponse.PluginInformation... 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 newQueryResponsewith the supplied data. The current instance can be reused after this method is called.- Returns:
- response
-
-