mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-28 19:03:51 -07:00
Added service register and unregister events. Addresses BUKKIT-816
By: zml2008 <zach@zachsthings.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user