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 forQueryResponse
objects.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QueryResponse
build()
Builds a newQueryResponse
with the supplied data.QueryResponse.Builder
clearPlayers()
Removes all players from the builder.QueryResponse.Builder
clearPlugins()
Clears all currently set plugins.QueryResponse.Builder
currentPlayers(int currentPlayers)
Sets the players that are currently claimed to be online.QueryResponse.Builder
gameVersion(String gameVersion)
Sets the game version for the response.QueryResponse.Builder
hostname(String hostname)
Sets the hostname for the response.QueryResponse.Builder
map(String map)
Sets the map that will appear in the response.QueryResponse.Builder
maxPlayers(int maxPlayers)
Sets the maximum number of players this server purportedly can hold.QueryResponse.Builder
players(String... players)
Adds the specified players to the player list.QueryResponse.Builder
players(Collection<String> players)
Adds the specified players to the player list.QueryResponse.Builder
plugins(QueryResponse.PluginInformation... plugins)
Adds the specified plugins to the plugins list.QueryResponse.Builder
plugins(Collection<QueryResponse.PluginInformation> plugins)
Adds the specified plugins to the plugins list.QueryResponse.Builder
proxyHost(String proxyHost)
Sets the host where this proxy is running.QueryResponse.Builder
proxyPort(int proxyPort)
Sets the port where this proxy is running.QueryResponse.Builder
proxyVersion(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 newQueryResponse
with the supplied data. The current instance can be reused after this method is called.- Returns:
- response
-
-