Class ServerPing
java.lang.Object
com.velocitypowered.api.proxy.server.ServerPing
Represents a 1.7 and above server list ping response. This class is immutable.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA builder forServerPingobjects.static final classRepresents what the players the server purports to have online, its maximum capacity, and a sample of players on the server.static final classA player returned in the sample field of the server ping players field.static final classRepresents the version of the server sent to the client. -
Constructor Summary
ConstructorsConstructorDescriptionServerPing(ServerPing.Version version, @Nullable ServerPing.Players players, Component description, @Nullable Favicon favicon) Constructs an initial ServerPing instance.ServerPing(ServerPing.Version version, @Nullable ServerPing.Players players, Component description, @Nullable Favicon favicon, @Nullable ModInfo modinfo) Constructs a ServerPing instance. -
Method Summary
Modifier and TypeMethodDescriptionReturns a copy of thisServerPinginstance as a builder so that it can be modified.static ServerPing.Builderbuilder()Creates a newServerPing.Builderfor constructing aServerPing.boolean@Nullable ComponentGets the description (MOTD) component shown in the ping response.Gets the favicon sent to the client.Gets the mod info sent to the client.Gets the player information shown to the client.Gets the version shown to the client during the ping.inthashCode()toString()
-
Constructor Details
-
ServerPing
public ServerPing(ServerPing.Version version, @Nullable ServerPing.Players players, Component description, @Nullable Favicon favicon) Constructs an initial ServerPing instance.- Parameters:
version- the version of the serverplayers- the players on the server, ornullif not showndescription- the MOTD for the serverfavicon- the server's favicon, ornullif not set
-
ServerPing
public ServerPing(ServerPing.Version version, @Nullable ServerPing.Players players, Component description, @Nullable Favicon favicon, @Nullable ModInfo modinfo) Constructs a ServerPing instance.- Parameters:
version- the version of the serverplayers- the players on the serverdescription- the MOTD for the serverfavicon- the server's faviconmodinfo- the mods this server runs
-
-
Method Details
-
getVersion
Gets the version shown to the client during the ping.- Returns:
- the version
-
getPlayers
Gets the player information shown to the client.- Returns:
- the player information, or empty if not shown
-
getDescriptionComponent
Gets the description (MOTD) component shown in the ping response.- Returns:
- the description component
-
getFavicon
Gets the favicon sent to the client.- Returns:
- the favicon, or empty if not present
-
getModinfo
Gets the mod info sent to the client.- Returns:
- the mod info, or empty if not present
-
toString
-
equals
-
hashCode
public int hashCode() -
asBuilder
Returns a copy of thisServerPinginstance as a builder so that it can be modified. It is guaranteed thatping.asBuilder().build().equals(ping)is true: that is, if no other changes are made to the returned builder, the built instance will equal the original instance.- Returns:
- a copy of this instance as a
ServerPing.Builder
-
builder
Creates a newServerPing.Builderfor constructing aServerPing.- Returns:
- a new ServerPing builder
-