Added service register and unregister events. Addresses BUKKIT-816

By: zml2008 <zach@zachsthings.com>
This commit is contained in:
Bukkit/Spigot
2011-11-12 20:22:30 -08:00
parent 1d03cfb423
commit 860011dcc1
4 changed files with 84 additions and 4 deletions

View File

@@ -0,0 +1,18 @@
package org.bukkit.event.server;
import org.bukkit.plugin.RegisteredServiceProvider;
/**
* An event relating to a registered service. This is called in a {@link org.bukkit.plugin.ServicesManager}
*/
public abstract class ServiceEvent extends ServerEvent {
private final RegisteredServiceProvider<?> provider;
public ServiceEvent(final RegisteredServiceProvider<?> provider) {
this.provider = provider;
}
public RegisteredServiceProvider<?> getProvider() {
return provider;
}
}

View File

@@ -0,0 +1,23 @@
package org.bukkit.event.server;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.RegisteredServiceProvider;
/**
* This event is called when a service is registered.
*/
public class ServiceRegisterEvent extends ServiceEvent {
private static final HandlerList handlers = new HandlerList();
public ServiceRegisterEvent(RegisteredServiceProvider<?> registeredProvider) {
super(registeredProvider);
}
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -0,0 +1,23 @@
package org.bukkit.event.server;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.RegisteredServiceProvider;
/**
* This event is called when a service is unregistered.
*/
public class ServiceUnregisterEvent extends ServiceEvent {
private static final HandlerList handlers = new HandlerList();
public ServiceUnregisterEvent(RegisteredServiceProvider<?> serviceProvider) {
super(serviceProvider);
}
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}