Add javadoc for ServerPing.Builder (#1500)
* Add javadoc for ServerPing.Builder * Address codestyle reports
This commit is contained in:
@@ -159,31 +159,68 @@ public final class ServerPing {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses the modified {@code version} info in the response.
|
||||||
|
*
|
||||||
|
* @param version version info to set
|
||||||
|
* @return this builder, for chaining
|
||||||
|
*/
|
||||||
public Builder version(Version version) {
|
public Builder version(Version version) {
|
||||||
this.version = Preconditions.checkNotNull(version, "version");
|
this.version = Preconditions.checkNotNull(version, "version");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses the modified {@code onlinePlayers} number in the response.
|
||||||
|
*
|
||||||
|
* @param onlinePlayers number for online players to set
|
||||||
|
* @return this builder, for chaining
|
||||||
|
*/
|
||||||
public Builder onlinePlayers(int onlinePlayers) {
|
public Builder onlinePlayers(int onlinePlayers) {
|
||||||
this.onlinePlayers = onlinePlayers;
|
this.onlinePlayers = onlinePlayers;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses the modified {@code maximumPlayers} number in the response.
|
||||||
|
* <b>This will not modify the actual maximum players that can join the server.</b>
|
||||||
|
*
|
||||||
|
* @param maximumPlayers number for maximum players to set
|
||||||
|
* @return this builder, for chaining
|
||||||
|
*/
|
||||||
public Builder maximumPlayers(int maximumPlayers) {
|
public Builder maximumPlayers(int maximumPlayers) {
|
||||||
this.maximumPlayers = maximumPlayers;
|
this.maximumPlayers = maximumPlayers;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses the modified {@code players} array in the response.
|
||||||
|
*
|
||||||
|
* @param players array of SamplePlayers to set
|
||||||
|
* @return this builder, for chaining
|
||||||
|
*/
|
||||||
public Builder samplePlayers(SamplePlayer... players) {
|
public Builder samplePlayers(SamplePlayer... players) {
|
||||||
this.samplePlayers.addAll(Arrays.asList(players));
|
this.samplePlayers.addAll(Arrays.asList(players));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses the modified {@code modType} in the response.
|
||||||
|
*
|
||||||
|
* @param modType the mod type to set
|
||||||
|
* @return this builder, for chaining
|
||||||
|
*/
|
||||||
public Builder modType(String modType) {
|
public Builder modType(String modType) {
|
||||||
this.modType = Preconditions.checkNotNull(modType, "modType");
|
this.modType = Preconditions.checkNotNull(modType, "modType");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses the modified {@code mods} array in the response.
|
||||||
|
*
|
||||||
|
* @param mods array of mods to use
|
||||||
|
* @return this builder, for chaining
|
||||||
|
*/
|
||||||
public Builder mods(ModInfo.Mod... mods) {
|
public Builder mods(ModInfo.Mod... mods) {
|
||||||
this.mods.addAll(Arrays.asList(mods));
|
this.mods.addAll(Arrays.asList(mods));
|
||||||
return this;
|
return this;
|
||||||
@@ -193,7 +230,7 @@ public final class ServerPing {
|
|||||||
* Uses the modified {@code mods} list in the response.
|
* Uses the modified {@code mods} list in the response.
|
||||||
*
|
*
|
||||||
* @param mods the mods list to use
|
* @param mods the mods list to use
|
||||||
* @return this build, for chaining
|
* @return this builder, for chaining
|
||||||
*/
|
*/
|
||||||
public Builder mods(ModInfo mods) {
|
public Builder mods(ModInfo mods) {
|
||||||
Preconditions.checkNotNull(mods, "mods");
|
Preconditions.checkNotNull(mods, "mods");
|
||||||
@@ -203,36 +240,74 @@ public final class ServerPing {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the current list of mods to use in the response.
|
||||||
|
*
|
||||||
|
* @return this builder, for chaining
|
||||||
|
*/
|
||||||
public Builder clearMods() {
|
public Builder clearMods() {
|
||||||
this.mods.clear();
|
this.mods.clear();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the current list of PlayerSamples to use in the response.
|
||||||
|
*
|
||||||
|
* @return this builder, for chaining
|
||||||
|
*/
|
||||||
public Builder clearSamplePlayers() {
|
public Builder clearSamplePlayers() {
|
||||||
this.samplePlayers.clear();
|
this.samplePlayers.clear();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the server as mod incompatible in the response.
|
||||||
|
*
|
||||||
|
* @return this builder, for chaining
|
||||||
|
*/
|
||||||
public Builder notModCompatible() {
|
public Builder notModCompatible() {
|
||||||
this.nullOutModinfo = true;
|
this.nullOutModinfo = true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables nulling Players in the response.
|
||||||
|
* This will display the player count as {@code ???}.
|
||||||
|
*
|
||||||
|
* @return this builder, for chaining
|
||||||
|
*/
|
||||||
public Builder nullPlayers() {
|
public Builder nullPlayers() {
|
||||||
this.nullOutPlayers = true;
|
this.nullOutPlayers = true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses the {@code description} Component in the response.
|
||||||
|
*
|
||||||
|
* @param description Component to use as the description.
|
||||||
|
* @return this builder, for chaining
|
||||||
|
*/
|
||||||
public Builder description(net.kyori.adventure.text.Component description) {
|
public Builder description(net.kyori.adventure.text.Component description) {
|
||||||
this.description = Preconditions.checkNotNull(description, "description");
|
this.description = Preconditions.checkNotNull(description, "description");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses the {@code favicon} in the response.
|
||||||
|
*
|
||||||
|
* @param favicon Favicon instance to use.
|
||||||
|
* @return this builder, for chaining
|
||||||
|
*/
|
||||||
public Builder favicon(Favicon favicon) {
|
public Builder favicon(Favicon favicon) {
|
||||||
this.favicon = Preconditions.checkNotNull(favicon, "favicon");
|
this.favicon = Preconditions.checkNotNull(favicon, "favicon");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the current favicon used in the response.
|
||||||
|
*
|
||||||
|
* @return this builder, for chaining
|
||||||
|
*/
|
||||||
public Builder clearFavicon() {
|
public Builder clearFavicon() {
|
||||||
this.favicon = null;
|
this.favicon = null;
|
||||||
return this;
|
return this;
|
||||||
|
Reference in New Issue
Block a user