public class WrappedServerPing extends AbstractWrapper
Modifier and Type | Class and Description |
---|---|
static class |
WrappedServerPing.CompressedImage
Represents a compressed favicon.
|
handle, handleType
Constructor and Description |
---|
WrappedServerPing()
Construct a new server ping initialized with a zero player count, and zero maximum.
|
Modifier and Type | Method and Description |
---|---|
WrappedServerPing |
deepClone()
Retrieve a deep copy of the current wrapper object.
|
static WrappedServerPing |
fromHandle(java.lang.Object handle)
Construct a wrapped server ping from a native NMS object.
|
static WrappedServerPing |
fromJson(java.lang.String json)
Construct a wrapper server ping from an encoded JSON string.
|
WrappedServerPing.CompressedImage |
getFavicon()
Retrieve the compressed PNG file that is being displayed as a favicon.
|
WrappedChatComponent |
getMotD()
Retrieve the message of the day.
|
com.google.common.collect.ImmutableList<WrappedGameProfile> |
getPlayers()
Retrieve a copy of all the logged in players.
|
int |
getPlayersMaximum()
Retrieve the displayed maximum number of players.
|
int |
getPlayersOnline()
Retrieve the displayed number of online players.
|
java.lang.String |
getVersionName()
Retrieve the version name of the current server.
|
int |
getVersionProtocol()
Retrieve the protocol number.
|
boolean |
isPlayersVisible()
Determine if the player count and maximum is visible.
|
protected void |
resetPlayers()
Set the player count and player maximum to the default values.
|
protected void |
resetVersion()
Reset the version string to the default state.
|
void |
setBukkitPlayers(java.lang.Iterable<? extends org.bukkit.entity.Player> players)
Set the displayed lst of logged in players.
|
void |
setFavicon(WrappedServerPing.CompressedImage image)
Set the compressed PNG file that is being displayed.
|
void |
setMotD(java.lang.String message)
Set the message of the day.
|
void |
setMotD(WrappedChatComponent description)
Set the message of the day.
|
void |
setPlayers(java.lang.Iterable<? extends WrappedGameProfile> profile)
Set the displayed list of logged in players.
|
void |
setPlayersMaximum(int maximum)
Set the displayed maximum number of players.
|
void |
setPlayersOnline(int online)
Set the displayed number of online players.
|
void |
setPlayersVisible(boolean visible)
Set whether or not the player count and player maximum is visible.
|
void |
setVersionName(java.lang.String name)
Set the version name of the current server.
|
void |
setVersionProtocol(int protocol)
Set the version protocol
|
java.lang.String |
toJson()
Retrieve the underlying JSON representation of this server ping.
|
java.lang.String |
toString() |
getHandle, getHandleType, setHandle
public WrappedServerPing()
Note that the version string is set to 1.7.2.
protected void resetPlayers()
protected void resetVersion()
public static WrappedServerPing fromHandle(java.lang.Object handle)
handle
- - the native object.public static WrappedServerPing fromJson(java.lang.String json)
json
- - the JSON string.public WrappedChatComponent getMotD()
public void setMotD(WrappedChatComponent description)
description
- - message of the day.public void setMotD(java.lang.String message)
description
- - the message.public WrappedServerPing.CompressedImage getFavicon()
public void setFavicon(WrappedServerPing.CompressedImage image)
image
- - the new compressed image or NULL if no favicon should be displayed.public int getPlayersOnline()
java.lang.IllegalStateException
- If the player count has been hidden via setPlayersVisible(boolean)
.#setPlayersOnline(int)} for more information.
public void setPlayersOnline(int online)
As of 1.7.2, this is completely unrestricted, and can be both positive and negative, as well as higher than the player maximum.
online
- - online players.public int getPlayersMaximum()
java.lang.IllegalStateException
- If the player maximum has been hidden via setPlayersVisible(boolean)
.#setPlayersMaximum(int)} for more information.
public void setPlayersMaximum(int maximum)
The 1.7.2 accepts any value as a player maximum, positive or negative. It even permits a player maximum that is less than the player count.
maximum
- - maximum player count.public void setPlayersVisible(boolean visible)
Note that this may set the current player count and maximum to their respective real values.
visible
- - TRUE if it should be visible, FALSE otherwise.public boolean isPlayersVisible()
If not, the client will display ??? in the same location.
public com.google.common.collect.ImmutableList<WrappedGameProfile> getPlayers()
public void setPlayers(java.lang.Iterable<? extends WrappedGameProfile> profile)
profile
- - every logged in player.public void setBukkitPlayers(java.lang.Iterable<? extends org.bukkit.entity.Player> players)
players
- - the players to display.public java.lang.String getVersionName()
public void setVersionName(java.lang.String name)
name
- - the new version name.public int getVersionProtocol()
public void setVersionProtocol(int protocol)
protocol
- - the protocol number.public WrappedServerPing deepClone()
public java.lang.String toJson()
public java.lang.String toString()
toString
in class java.lang.Object