[Bleeding] Changed event system into a new, much faster design. Huge thanks to @zml2008 & @lahwran.

By: Nathan Adams <dinnerbone@dinnerbone.com>
This commit is contained in:
Bukkit/Spigot
2012-01-16 18:25:17 +00:00
parent 94bc6ec0e6
commit e0c7fc6bf5
132 changed files with 1691 additions and 225 deletions

View File

@@ -1,6 +1,7 @@
package org.bukkit.event.server;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.map.MapView;
/**
@@ -8,6 +9,7 @@ import org.bukkit.map.MapView;
*/
@SuppressWarnings("serial")
public class MapInitializeEvent extends ServerEvent {
private static final HandlerList handlers = new HandlerList();
private final MapView mapView;
public MapInitializeEvent(MapView mapView) {
@@ -23,4 +25,13 @@ public class MapInitializeEvent extends ServerEvent {
public MapView getMap() {
return mapView;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -1,5 +1,6 @@
package org.bukkit.event.server;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.Plugin;
/**
@@ -7,7 +8,17 @@ import org.bukkit.plugin.Plugin;
*/
@SuppressWarnings("serial")
public class PluginDisableEvent extends PluginEvent {
private static final HandlerList handlers = new HandlerList();
public PluginDisableEvent(Plugin plugin) {
super(Type.PLUGIN_DISABLE, plugin);
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -1,5 +1,6 @@
package org.bukkit.event.server;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.Plugin;
/**
@@ -7,7 +8,17 @@ import org.bukkit.plugin.Plugin;
*/
@SuppressWarnings("serial")
public class PluginEnableEvent extends PluginEvent {
private static final HandlerList handlers = new HandlerList();
public PluginEnableEvent(Plugin plugin) {
super(Type.PLUGIN_ENABLE, plugin);
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -6,7 +6,7 @@ import org.bukkit.plugin.Plugin;
* Used for plugin enable and disable events
*/
@SuppressWarnings("serial")
public class PluginEvent extends ServerEvent {
public abstract class PluginEvent extends ServerEvent {
private final Plugin plugin;
public PluginEvent(final Type type, final Plugin plugin) {

View File

@@ -2,12 +2,14 @@ package org.bukkit.event.server;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.event.HandlerList;
/**
* Server Command events
*/
@SuppressWarnings("serial")
public class ServerCommandEvent extends ServerEvent {
private static final HandlerList handlers = new HandlerList();
private String command;
private CommandSender sender;
@@ -48,4 +50,13 @@ public class ServerCommandEvent extends ServerEvent {
public CommandSender getSender() {
return sender;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -6,7 +6,7 @@ import org.bukkit.event.Event;
* Miscellaneous server events
*/
@SuppressWarnings("serial")
public class ServerEvent extends Event {
public abstract class ServerEvent extends Event {
public ServerEvent(final Type type) {
super(type);
}

View File

@@ -3,12 +3,14 @@ package org.bukkit.event.server;
import java.net.InetAddress;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* Called when a server list ping is coming in.
*/
@SuppressWarnings("serial")
public class ServerListPingEvent extends ServerEvent {
private static final HandlerList handlers = new HandlerList();
private InetAddress address;
private String motd;
@@ -76,4 +78,13 @@ public class ServerListPingEvent extends ServerEvent {
public void setMaxPlayers(int maxPlayers) {
this.maxPlayers = maxPlayers;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -5,6 +5,7 @@ import org.bukkit.event.Listener;
/**
* Handles all miscellaneous server events
*/
@Deprecated
public class ServerListener implements Listener {
/**