Class LegacyServerPing
java.lang.Object
com.comphenix.protocol.wrappers.AbstractWrapper
com.comphenix.protocol.wrappers.ping.LegacyServerPing
- All Implemented Interfaces:
ServerPingImpl,Cloneable
Represents a server ping packet data.
-
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.LegacyServerPing(Object handle) -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermine if the player count and maximum is visible.Retrieve a deep copy of the current wrapper object.static LegacyServerPingfromHandle(Object handle) Construct a wrapped server ping from a native NMS object.static LegacyServerPingConstruct a wrapper server ping from an encoded JSON string.Retrieve the compressed PNG file that is being displayed as a favicon.getJson()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.booleanDeprecated.Removed in 1.19.3booleanSets whether the server enforces secure chat.voidSet the player count and player maximum to the default values.voidReset the version string to the default state.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.voidsetPlayers(Iterable<? extends WrappedGameProfile> playerSample) 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.ping.ServerPingImpl
getHandle
-
Constructor Details
-
LegacyServerPing
public LegacyServerPing()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.
-
LegacyServerPing
-
-
Method Details
-
resetPlayers
public void resetPlayers()Set the player count and player maximum to the default values.- Specified by:
resetPlayersin interfaceServerPingImpl
-
resetVersion
public void resetVersion()Reset the version string to the default state.- Specified by:
resetVersionin interfaceServerPingImpl
-
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.- Specified by:
getMotDin interfaceServerPingImpl- Returns:
- The message of the day.
-
setMotD
Set the message of the day.- Specified by:
setMotDin interfaceServerPingImpl- Parameters:
description- - message of the day.
-
getFavicon
Retrieve the compressed PNG file that is being displayed as a favicon.- Specified by:
getFaviconin interfaceServerPingImpl- Returns:
- The favicon, or NULL if no favicon will be displayed.
-
setFavicon
Set the compressed PNG file that is being displayed.- Specified by:
setFaviconin interfaceServerPingImpl- 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.- Specified by:
isChatPreviewEnabledin interfaceServerPingImpl- 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.- Specified by:
setChatPreviewEnabledin interfaceServerPingImpl- Parameters:
chatPreviewEnabled- true if enabled, false otherwise.- Since:
- 1.19
-
isEnforceSecureChat
public boolean isEnforceSecureChat()Sets whether the server enforces secure chat.- Specified by:
isEnforceSecureChatin interfaceServerPingImpl- Returns:
- whether the server enforces secure chat.
- Since:
- 1.19.1
-
setEnforceSecureChat
public void setEnforceSecureChat(boolean enforceSecureChat) Sets whether the server enforces secure chat.- Specified by:
setEnforceSecureChatin interfaceServerPingImpl- Parameters:
enforceSecureChat- true if enabled, false otherwise.- Since:
- 1.19.1
-
getPlayersOnline
public int getPlayersOnline()Retrieve the displayed number of online players.- Specified by:
getPlayersOnlinein interfaceServerPingImpl- 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.
- Specified by:
setPlayersOnlinein interfaceServerPingImpl- Parameters:
online- - online players.
-
getPlayersMaximum
public int getPlayersMaximum()Retrieve the displayed maximum number of players.- Specified by:
getPlayersMaximumin interfaceServerPingImpl- 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.
- Specified by:
setPlayersMaximumin interfaceServerPingImpl- 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.
- Specified by:
setPlayersVisiblein interfaceServerPingImpl- Parameters:
visible- - TRUE if it should be visible, FALSE otherwise.
-
getJson
- Specified by:
getJsonin interfaceServerPingImpl
-
arePlayersVisible
public boolean arePlayersVisible()Determine if the player count and maximum is visible.If not, the client will display ??? in the same location.
- Specified by:
arePlayersVisiblein interfaceServerPingImpl- Returns:
- TRUE if the player statistics is visible, FALSE otherwise.
-
getPlayers
Retrieve a copy of all the logged in players.- Specified by:
getPlayersin interfaceServerPingImpl- Returns:
- Logged in players or an empty list if no player names will be displayed.
-
setPlayers
Set the displayed list of logged in players.- Specified by:
setPlayersin interfaceServerPingImpl- Parameters:
playerSample- - every logged in player.
-
getVersionName
Retrieve the version name of the current server.- Specified by:
getVersionNamein interfaceServerPingImpl- Returns:
- The version name.
-
setVersionName
Set the version name of the current server.- Specified by:
setVersionNamein interfaceServerPingImpl- Parameters:
name- - the new version name.
-
getVersionProtocol
public int getVersionProtocol()Retrieve the protocol number.- Specified by:
getVersionProtocolin interfaceServerPingImpl- Returns:
- The protocol.
-
setVersionProtocol
public void setVersionProtocol(int protocol) Set the version protocol- Specified by:
setVersionProtocolin interfaceServerPingImpl- Parameters:
protocol- - the protocol number.
-
deepClone
Retrieve a deep copy of the current wrapper object.- Returns:
- The current object.
-
toJson
Retrieve the underlying JSON representation of this server ping.- Returns:
- The JSON representation.
-
toString
- Overrides:
toStringin classAbstractWrapper
-