Package org.bukkit.event.server
Class ServerListPingEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.server.ServerEvent
org.bukkit.event.server.ServerListPingEvent
Called when a server list ping is coming in. Displayed players can be
checked and removed by
Note: The players in
iterating
over this event.
Note: The players in
iterator()
will not be shown in the
server info if Bukkit.getHideOnlinePlayers()
is true.-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Constructor Summary
ModifierConstructorDescriptionprotected
ServerListPingEvent
(String hostname, InetAddress address, String motd, int maxPlayers) This constructor is intended for implementations that provide theiterator()
method, thus provided thegetNumPlayers()
count.ServerListPingEvent
(String hostname, InetAddress address, String motd, int numPlayers, int maxPlayers) -
Method Summary
Modifier and TypeMethodDescriptionGet the address the ping is coming from.static HandlerList
Gets the hostname that the player used to connect to the server, or blank if unknownint
Get the maximum number of players sent.getMotd()
Get the message of the day message.int
Get the number of players sent.iterator()
void
setMaxPlayers
(int maxPlayers) Set the maximum number of players sent.void
Change the message of the day message.void
Sets the server-icon sent to the client.boolean
Deprecated.chat previews have been removedMethods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ServerListPingEvent
-
ServerListPingEvent
protected ServerListPingEvent(@NotNull String hostname, @NotNull InetAddress address, @NotNull String motd, int maxPlayers) This constructor is intended for implementations that provide theiterator()
method, thus provided thegetNumPlayers()
count.- Parameters:
hostname
- The hostname that was used to connect to the serveraddress
- the address of the pingermotd
- the message of the daymaxPlayers
- the max number of players
-
-
Method Details
-
getHostname
Gets the hostname that the player used to connect to the server, or blank if unknown- Returns:
- The hostname
-
getAddress
Get the address the ping is coming from.- Returns:
- the address
-
getMotd
Get the message of the day message.- Returns:
- the message of the day
-
setMotd
Change the message of the day message.- Parameters:
motd
- the message of the day
-
getNumPlayers
public int getNumPlayers()Get the number of players sent.- Returns:
- the number of players
-
getMaxPlayers
public int getMaxPlayers()Get the maximum number of players sent.- Returns:
- the maximum number of players
-
shouldSendChatPreviews
Deprecated.chat previews have been removedGets whether the server needs to send a preview of the chat to the client.- Returns:
- true if chat preview is enabled, false otherwise
-
setMaxPlayers
public void setMaxPlayers(int maxPlayers) Set the maximum number of players sent.- Parameters:
maxPlayers
- the maximum number of player
-
setServerIcon
public void setServerIcon(CachedServerIcon icon) throws IllegalArgumentException, UnsupportedOperationException Sets the server-icon sent to the client.- Parameters:
icon
- the icon to send to the client- Throws:
IllegalArgumentException
- if theCachedServerIcon
is not created by the caller of this event; null may be accepted for some implementationsUnsupportedOperationException
- if the caller of this event does not support setting the server icon
-
getHandlers
- Specified by:
getHandlers
in classEvent
-
getHandlerList
-
iterator
Calling the
Iterator.remove()
method will force that particular player to not be displayed on the player list, decrease the size returned bygetNumPlayers()
, and will not be returned again by any new iterator.
Note: The players here will not be shown in the server info ifBukkit.getHideOnlinePlayers()
is true.- Specified by:
iterator
in interfaceIterable<Player>
- Throws:
UnsupportedOperationException
- if the caller of this event does not support removing players
-