Package org.bukkit.event.server
Class ServerListPingEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.server.ServerEvent
org.bukkit.event.server.ServerListPingEvent
- Direct Known Subclasses:
- PaperServerListPingEvent
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 SummaryNested classes/interfaces inherited from class org.bukkit.event.EventEvent.Result
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedServerListPingEvent(@NotNull String hostname, @NotNull InetAddress address, @NotNull String motd, int maxPlayers) Deprecated.ServerListPingEvent(@NotNull String hostname, @NotNull InetAddress address, @NotNull String motd, int numPlayers, int maxPlayers) protectedServerListPingEvent(@NotNull String hostname, @NotNull InetAddress address, @NotNull Component motd, int maxPlayers) This constructor is intended for implementations that provide theiterator()method, thus provided thegetNumPlayers()count.ServerListPingEvent(@NotNull String hostname, @NotNull InetAddress address, Component motd, int numPlayers, int maxPlayers) protectedServerListPingEvent(@NotNull InetAddress address, Component motd, int maxPlayers) Deprecated.ServerListPingEvent(@NotNull InetAddress address, Component motd, int numPlayers, int maxPlayers) Deprecated.
- 
Method SummaryModifier and TypeMethodDescriptionGet the address the ping is coming from.static @NotNull HandlerListGets the hostname that the player used to connect to the server, or blank if unknownintGet the maximum number of players sent.getMotd()Deprecated.in favour ofmotd()intGet the number of players sent.iterator()motd()Get the message of the day message.voidChange the message of the day message.voidsetMaxPlayers(int maxPlayers) Set the maximum number of players sent.voidDeprecated.in favour ofmotd(net.kyori.adventure.text.Component)voidSets the server-icon sent to the client.booleanDeprecated.chat previews have been removedMethods inherited from class org.bukkit.event.EventcallEvent, getEventName, isAsynchronousMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Constructor Details- 
ServerListPingEvent
- 
ServerListPingEvent@Deprecated protected ServerListPingEvent(@NotNull @NotNull String hostname, @NotNull @NotNull InetAddress address, @NotNull @NotNull String motd, int maxPlayers) Deprecated.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 server
- address- the address of the pinger
- motd- the message of the day
- maxPlayers- the max number of players
 
- 
ServerListPingEvent@Deprecated public ServerListPingEvent(@NotNull @NotNull InetAddress address, @NotNull Component motd, int numPlayers, int maxPlayers) Deprecated.
- 
ServerListPingEvent
- 
ServerListPingEvent@Deprecated protected ServerListPingEvent(@NotNull @NotNull InetAddress address, @NotNull Component motd, int maxPlayers) Deprecated.This constructor is intended for implementations that provide theiterator()method, thus provided thegetNumPlayers()count.- Parameters:
- address- the address of the pinger
- motd- the message of the day
- maxPlayers- the max number of players
 
- 
ServerListPingEventprotected ServerListPingEvent(@NotNull @NotNull String hostname, @NotNull @NotNull InetAddress address, @NotNull Component 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 server
- address- the address of the pinger
- motd- the message of the day
- maxPlayers- the max number of players
 
 
- 
- 
Method Details- 
motdGet the message of the day message.- Returns:
- the message of the day
 
- 
motdChange the message of the day message.- Parameters:
- motd- the message of the day
 
- 
getHostnameGets the hostname that the player used to connect to the server, or blank if unknown- Returns:
- The hostname
 
- 
getAddressGet the address the ping is coming from.- Returns:
- the address
 
- 
getMotdDeprecated.in favour ofmotd()Get the message of the day message.- Returns:
- the message of the day
 
- 
setMotdDeprecated.in favour ofmotd(net.kyori.adventure.text.Component)Change the message of the day message.- Parameters:
- motd- the message of the day
 
- 
getNumPlayerspublic int getNumPlayers()Get the number of players sent.- Returns:
- the number of players
 
- 
getMaxPlayerspublic int getMaxPlayers()Get the maximum number of players sent.- Returns:
- the maximum number of players
 
- 
shouldSendChatPreviewsDeprecated.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
 
- 
setMaxPlayerspublic void setMaxPlayers(int maxPlayers) Set the maximum number of players sent.- Parameters:
- maxPlayers- the maximum number of player
 
- 
setServerIconpublic void setServerIcon(@UndefinedNullability("implementation dependent") 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 the- CachedServerIconis not created by the caller of this event; null may be accepted for some implementations
- UnsupportedOperationException- if the caller of this event does not support setting the server icon
 
- 
getHandlers- Specified by:
- getHandlersin class- Event
 
- 
getHandlerList
- 
iteratorCalling 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:
- iteratorin interface- Iterable<Player>
- Throws:
- UnsupportedOperationException- if the caller of this event does not support removing players
 
 
- 
ServerListPingEvent(String, java.net.InetAddress, net.kyori.adventure.text.Component, int)