Package com.comphenix.protocol.wrappers
Class WrappedServerPing
java.lang.Object
com.comphenix.protocol.wrappers.WrappedServerPing
- All Implemented Interfaces:
ClonableWrapper
Represents a server ping packet data.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a compressed favicon. -
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.booleanstatic 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.inthashCode()booleanDeprecated.Removed in 1.19.3booleanSets whether the server enforces secure chat.booleanDetermine if the player count and maximum is visible.voidsetBukkitPlayers(Iterable<? extends org.bukkit.entity.Player> players) Set the displayed lst of logged in players.voidsetChatPreviewEnabled(boolean chatPreviewEnabled) Deprecated.Removed in 1.19.3voidsetEnforceSecureChat(boolean enforceSecureChat) Sets whether the server enforces secure chat.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()
-
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
-
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 message 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.
-
isChatPreviewEnabled
Deprecated.Removed in 1.19.3Retrieve whether chat preview is enabled on the server.- Returns:
- whether chat preview is enabled on the server.
- Since:
- 1.19
-
setChatPreviewEnabled
Deprecated.Removed in 1.19.3Sets whether chat preview is enabled on the server.- Parameters:
chatPreviewEnabled- true if enabled, false otherwise.- Since:
- 1.19
-
isEnforceSecureChat
public boolean isEnforceSecureChat()Sets whether the server enforces secure chat.- Returns:
- whether the server enforces secure chat.
- Since:
- 1.19.1
-
setEnforceSecureChat
public void setEnforceSecureChat(boolean enforceSecureChat) Sets whether the server enforces secure chat.- Parameters:
enforceSecureChat- true if enabled, false otherwise.- Since:
- 1.19.1
-
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
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
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.
-
getHandle
- Specified by:
getHandlein interfaceClonableWrapper
-
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
-
equals
-
hashCode
public int hashCode()
-