Package top.focess.qq.api.event
Class ListenerHandler
- java.lang.Object
-
- top.focess.qq.api.event.ListenerHandler
-
public class ListenerHandler extends Object
This class is used to help invoke listener methods
-
-
Constructor Summary
Constructors Constructor Description ListenerHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Event>
voidregister(Listener listener, Method method, EventHandler handler)Register the listenerstatic voidregister(Plugin plugin, Listener listener)Add the listener and bundle to the plugin<T extends Event>
voidsubmit(T event)Submit the event to this listener handlervoidunregister(Listener listener)Unregister the listenerstatic voidunregister(Plugin plugin)Unregister all listeners bundled to the pluginstatic voidunregister(Plugin plugin, Listener listener)Unregister the listener by the pluginstatic booleanunregisterAll()Unregister all listeners
-
-
-
Method Detail
-
unregister
public static void unregister(Plugin plugin)
Unregister all listeners bundled to the plugin- Parameters:
plugin- the plugin which need to unregister all its listeners
-
unregister
public static void unregister(Plugin plugin, Listener listener)
Unregister the listener by the plugin- Parameters:
plugin- the plugin of the listenerlistener- the listener need to be unregistered
-
register
public static void register(Plugin plugin, Listener listener)
Add the listener and bundle to the plugin- Parameters:
plugin- the pluginlistener- the listener
-
unregisterAll
public static boolean unregisterAll()
Unregister all listeners- Returns:
- true if there are some listeners not belonging to MainPlugin not been unregistered, false otherwise
-
unregister
public void unregister(Listener listener)
Unregister the listener- Parameters:
listener- the listener need to be unregistered
-
register
public <T extends Event> void register(Listener listener, Method method, EventHandler handler)
Register the listener- Type Parameters:
T- the event type- Parameters:
listener- the listenermethod- the listener method to this Event listener handlerhandler- the event handler
-
submit
public <T extends Event> void submit(T event)
Submit the event to this listener handler- Type Parameters:
T- the event type- Parameters:
event- the event need to be submitted
-
-