summaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/bukkit/event/Event.java6
-rw-r--r--src/main/java/org/bukkit/event/server/ServerListPingEvent.java80
-rw-r--r--src/main/java/org/bukkit/event/server/ServerListener.java7
-rw-r--r--src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java7
4 files changed, 100 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/Event.java b/src/main/java/org/bukkit/event/Event.java
index eb4c87d8..80e28132 100644
--- a/src/main/java/org/bukkit/event/Event.java
+++ b/src/main/java/org/bukkit/event/Event.java
@@ -504,6 +504,12 @@ public abstract class Event implements Serializable {
* @see org.bukkit.event.server.MapInitializeEvent
*/
MAP_INITIALIZE (Category.SERVER),
+ /**
+ * Called when a client pings a server.
+ *
+ * @see org.bukkit.event.server.ServerListPingEvent
+ */
+ SERVER_LIST_PING (Category.SERVER),
/**
* WORLD EVENTS
diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
new file mode 100644
index 00000000..b1f588f1
--- /dev/null
+++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
@@ -0,0 +1,80 @@
+package org.bukkit.event.server;
+
+import java.net.InetAddress;
+
+import org.bukkit.event.Event;
+
+/**
+ * Called when a server list ping is coming in.
+ *
+ * @author sk89q
+ */
+public class ServerListPingEvent extends ServerEvent {
+
+ private InetAddress address;
+ private String motd;
+ private int numPlayers;
+ private int maxPlayers;
+
+ public ServerListPingEvent(InetAddress address, String motd, int numPlayers, int maxPlayers) {
+ super(Event.Type.SERVER_LIST_PING);
+ this.address = address;
+ this.motd = motd;
+ this.numPlayers = numPlayers;
+ this.maxPlayers = maxPlayers;
+ }
+
+ /**
+ * Get the address the ping is coming from.
+ *
+ * @return the address
+ */
+ public InetAddress getAddress() {
+ return address;
+ }
+
+ /**
+ * Get the message of the day message.
+ *
+ * @return the message of the day
+ */
+ public String getMotd() {
+ return motd;
+ }
+
+ /**
+ * Change the message of the day message.
+ *
+ * @param motd the message of the day
+ */
+ public void setMotd(String motd) {
+ this.motd = motd;
+ }
+
+ /**
+ * Get the number of players sent.
+ *
+ * @return the number of players
+ */
+ public int getNumPlayers() {
+ return numPlayers;
+ }
+
+ /**
+ * Get the maximum number of players sent.
+ *
+ * @return the the maximum number of player
+ */
+ public int getMaxPlayers() {
+ return maxPlayers;
+ }
+
+ /**
+ * Set the maximum number of players sent.
+ *
+ * @param maxPlayers the maximum number of player
+ */
+ public void setMaxPlayers(int maxPlayers) {
+ this.maxPlayers = maxPlayers;
+ }
+}
diff --git a/src/main/java/org/bukkit/event/server/ServerListener.java b/src/main/java/org/bukkit/event/server/ServerListener.java
index f4bf722a..d49b1e0a 100644
--- a/src/main/java/org/bukkit/event/server/ServerListener.java
+++ b/src/main/java/org/bukkit/event/server/ServerListener.java
@@ -34,4 +34,11 @@ public class ServerListener implements Listener {
* @param event Relevant event details
*/
public void onMapInitialize(MapInitializeEvent event) {}
+
+ /**
+ * Called when a server list ping has come in.
+ *
+ * @param event Relevant event details
+ */
+ public void onServerListPing(ServerListPingEvent event) {}
}
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index 33d8bbe6..5489b852 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -584,6 +584,13 @@ public class JavaPluginLoader implements PluginLoader {
}
};
+ case SERVER_LIST_PING:
+ return new EventExecutor() {
+ public void execute(Listener listener, Event event) {
+ ((ServerListener) listener).onServerListPing((ServerListPingEvent) event);
+ }
+ };
+
// World Events
case CHUNK_LOAD:
return new EventExecutor() {