Package com.comphenix.protocol.wrappers
Class WrappedServerPing
java.lang.Object
com.comphenix.protocol.wrappers.AbstractWrapper
com.comphenix.protocol.wrappers.WrappedServerPing
- All Implemented Interfaces:
ClonableWrapper
Represents a server ping packet data.
- Author:
- Kristian
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a compressed favicon. -
Field Summary
Fields inherited from class com.comphenix.protocol.wrappers.AbstractWrapper
handle, handleType -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new server ping initialized with a zero player count, and zero maximum. -
Method Summary
Modifier and TypeMethodDescriptionRetrieve a deep copy of the current wrapper object.static WrappedServerPingfromHandle(Object handle)Construct a wrapped server ping from a native NMS object.static WrappedServerPingConstruct a wrapper server ping from an encoded JSON string.Retrieve the compressed PNG file that is being displayed as a favicon.getMotD()Retrieve the message of the day.com.google.common.collect.ImmutableList<WrappedGameProfile>Retrieve a copy of all the logged in players.intRetrieve the displayed maximum number of players.intRetrieve the displayed number of online players.Retrieve the version name of the current server.intRetrieve the protocol number.booleanDetermine if the player count and maximum is visible.protected voidSet the player count and player maximum to the default values.protected voidReset the version string to the default state.voidsetBukkitPlayers(Iterable<? extends org.bukkit.entity.Player> players)Set the displayed lst of logged in players.voidSet the compressed PNG file that is being displayed.voidsetMotD(WrappedChatComponent description)Set the message of the day.voidSet the message of the day.voidsetPlayers(Iterable<? extends WrappedGameProfile> profile)Set the displayed list of logged in players.voidsetPlayersMaximum(int maximum)Set the displayed maximum number of players.voidsetPlayersOnline(int online)Set the displayed number of online players.voidsetPlayersVisible(boolean visible)Set whether or not the player count and player maximum is visible.voidsetVersionName(String name)Set the version name of the current server.voidsetVersionProtocol(int protocol)Set the version protocoltoJson()Retrieve the underlying JSON representation of this server ping.toString()Methods inherited from class com.comphenix.protocol.wrappers.AbstractWrapper
equals, getHandle, getHandleType, hashCode, setHandleMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.comphenix.protocol.wrappers.ClonableWrapper
getHandle
-
Constructor Details
-
WrappedServerPing
public WrappedServerPing()Construct a new server ping initialized with a zero player count, and zero maximum.Note that the version string is set to 1.9.4.
-
-
Method Details
-
resetPlayers
protected void resetPlayers()Set the player count and player maximum to the default values. -
resetVersion
protected void resetVersion()Reset the version string to the default state. -
fromHandle
Construct a wrapped server ping from a native NMS object.- Parameters:
handle- - the native object.- Returns:
- The wrapped server ping object.
-
fromJson
Construct a wrapper server ping from an encoded JSON string.- Parameters:
json- - the JSON string.- Returns:
- The wrapped server ping.
-
getMotD
Retrieve the message of the day.- Returns:
- The messge of the day.
-
setMotD
Set the message of the day.- Parameters:
description- - message of the day.
-
setMotD
Set the message of the day.- Parameters:
message- - the message.
-
getFavicon
Retrieve the compressed PNG file that is being displayed as a favicon.- Returns:
- The favicon, or NULL if no favicon will be displayed.
-
setFavicon
Set the compressed PNG file that is being displayed.- Parameters:
image- - the new compressed image or NULL if no favicon should be displayed.
-
getPlayersOnline
public int getPlayersOnline()Retrieve the displayed number of online players.- Returns:
- The displayed number.
- Throws:
IllegalStateException- If the player count has been hidden viasetPlayersVisible(boolean).- See Also:
setPlayersOnline(int)
-
setPlayersOnline
public void setPlayersOnline(int online)Set the displayed number of online players.As of 1.7.2, this is completely unrestricted, and can be both positive and negative, as well as higher than the player maximum.
- Parameters:
online- - online players.
-
getPlayersMaximum
public int getPlayersMaximum()Retrieve the displayed maximum number of players.- Returns:
- The maximum number.
- Throws:
IllegalStateException- If the player maximum has been hidden viasetPlayersVisible(boolean).- See Also:
setPlayersMaximum(int)
-
setPlayersMaximum
public void setPlayersMaximum(int maximum)Set the displayed maximum number of players.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.
- Parameters:
maximum- - maximum player count.
-
setPlayersVisible
public void setPlayersVisible(boolean visible)Set whether or not the player count and player maximum is visible.Note that this may set the current player count and maximum to their respective real values.
- Parameters:
visible- - TRUE if it should be visible, FALSE otherwise.
-
isPlayersVisible
public boolean isPlayersVisible()Determine if the player count and maximum is visible.If not, the client will display ??? in the same location.
- Returns:
- TRUE if the player statistics is visible, FALSE otherwise.
-
getPlayers
Retrieve a copy of all the logged in players.- Returns:
- Logged in players or an empty list if no player names will be displayed.
-
setPlayers
Set the displayed list of logged in players.- Parameters:
profile- - every logged in player.
-
setBukkitPlayers
Set the displayed lst of logged in players.- Parameters:
players- - the players to display.
-
getVersionName
Retrieve the version name of the current server.- Returns:
- The version name.
-
setVersionName
Set the version name of the current server.- Parameters:
name- - the new version name.
-
getVersionProtocol
public int getVersionProtocol()Retrieve the protocol number.- Returns:
- The protocol.
-
setVersionProtocol
public void setVersionProtocol(int protocol)Set the version protocol- Parameters:
protocol- - the protocol number.
-
deepClone
Retrieve a deep copy of the current wrapper object.- Specified by:
deepClonein interfaceClonableWrapper- Returns:
- The current object.
-
toJson
Retrieve the underlying JSON representation of this server ping.- Returns:
- The JSON representation.
-
toString
- Overrides:
toStringin classAbstractWrapper
-