Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.event.server.ServerListPingEvent Class Reference
Inheritance diagram for org.bukkit.event.server.ServerListPingEvent:
org.bukkit.event.server.ServerEvent org.bukkit.event.Event

Public Member Functions

 ServerListPingEvent (final InetAddress address, final String motd, final int numPlayers, final int maxPlayers)
 
InetAddress getAddress ()
 
String getMotd ()
 
void setMotd (String motd)
 
int getNumPlayers ()
 
int getMaxPlayers ()
 
void setMaxPlayers (int maxPlayers)
 
void setServerIcon (CachedServerIcon icon) throws IllegalArgumentException, UnsupportedOperationException
 
HandlerList getHandlers ()
 
Iterator< Playeriterator () throws UnsupportedOperationException
 
- Public Member Functions inherited from org.bukkit.event.Event
 Event ()
 
 Event (boolean isAsync)
 
String getEventName ()
 
abstract HandlerList getHandlers ()
 
final boolean isAsynchronous ()
 

Static Public Member Functions

static HandlerList getHandlerList ()
 

Protected Member Functions

 ServerListPingEvent (final InetAddress address, final String motd, final int maxPlayers)
 

Detailed Description

Called when a server list ping is coming in. Displayed players can be checked and removed by iterating over this event.

Definition at line 15 of file ServerListPingEvent.java.

Constructor & Destructor Documentation

org.bukkit.event.server.ServerListPingEvent.ServerListPingEvent ( final InetAddress  address,
final String  motd,
final int  maxPlayers 
)
protected

This constructor is intended for implementations that provide the iterator() method, thus provided the getNumPlayers() count.

Definition at line 36 of file ServerListPingEvent.java.

36  {
37  this.numPlayers = MAGIC_PLAYER_COUNT;
38  this.address = address;
39  this.motd = motd;
40  this.maxPlayers = maxPlayers;
41  }

Member Function Documentation

InetAddress org.bukkit.event.server.ServerListPingEvent.getAddress ( )

Get the address the ping is coming from.

Returns
the address

Definition at line 48 of file ServerListPingEvent.java.

48  {
49  return address;
50  }
int org.bukkit.event.server.ServerListPingEvent.getMaxPlayers ( )

Get the maximum number of players sent.

Returns
the maximum number of players

Definition at line 91 of file ServerListPingEvent.java.

91  {
92  return maxPlayers;
93  }
String org.bukkit.event.server.ServerListPingEvent.getMotd ( )

Get the message of the day message.

Returns
the message of the day

Definition at line 57 of file ServerListPingEvent.java.

57  {
58  return motd;
59  }
int org.bukkit.event.server.ServerListPingEvent.getNumPlayers ( )

Get the number of players sent.

Returns
the number of players

Definition at line 75 of file ServerListPingEvent.java.

75  {
76  int numPlayers = this.numPlayers;
77  if (numPlayers == MAGIC_PLAYER_COUNT) {
78  numPlayers = 0;
79  for (@SuppressWarnings("unused") final Player player : this) {
80  numPlayers++;
81  }
82  }
83  return numPlayers;
84  }
Iterator<Player> org.bukkit.event.server.ServerListPingEvent.iterator ( ) throws UnsupportedOperationException

Calling the Iterator#remove() method will force that particular player to not be displayed on the player list, decrease the size returned by getNumPlayers(), and will not be returned again by any new iterator.

Exceptions
UnsupportedOperationExceptionif the caller of this event does not support removing players

Definition at line 139 of file ServerListPingEvent.java.

139  {
140  throw new UnsupportedOperationException();
141  }
void org.bukkit.event.server.ServerListPingEvent.setMaxPlayers ( int  maxPlayers)

Set the maximum number of players sent.

Parameters
maxPlayersthe maximum number of player

Definition at line 100 of file ServerListPingEvent.java.

100  {
101  this.maxPlayers = maxPlayers;
102  }
void org.bukkit.event.server.ServerListPingEvent.setMotd ( String  motd)

Change the message of the day message.

Parameters
motdthe message of the day

Definition at line 66 of file ServerListPingEvent.java.

66  {
67  this.motd = motd;
68  }
void org.bukkit.event.server.ServerListPingEvent.setServerIcon ( CachedServerIcon  icon) throws IllegalArgumentException, UnsupportedOperationException

Sets the server-icon sent to the client.

Parameters
iconthe icon to send to the client
Exceptions
IllegalArgumentExceptionif the CachedServerIcon is not created by the caller of this event; null may be accepted for some implementations
UnsupportedOperationExceptionif the caller of this event does not support setting the server icon

Definition at line 114 of file ServerListPingEvent.java.

114  {
115  throw new UnsupportedOperationException();
116  }

The documentation for this class was generated from the following file: