public interface EventManager
Modifier and Type | Method and Description |
---|---|
boolean |
post(Event event)
Calls a
Event to all listeners that listen to it. |
<T extends Event> |
registerListener(Object plugin,
Class<T> eventClass,
EventListener<? super T> listener)
Registers an event listener for a specific event class.
|
<T extends Event> |
registerListener(Object plugin,
Class<T> eventClass,
Order order,
boolean beforeModifications,
EventListener<? super T> listener)
Registers an event listener with the specified order for a specific event
class.
|
<T extends Event> |
registerListener(Object plugin,
Class<T> eventClass,
Order order,
EventListener<? super T> listener)
Registers an event listener with the specified order for a specific event
class.
|
<T extends Event> |
registerListener(Object plugin,
TypeToken<T> eventType,
EventListener<? super T> listener)
Registers an event listener for a specific event
TypeToken . |
<T extends Event> |
registerListener(Object plugin,
TypeToken<T> eventType,
Order order,
boolean beforeModifications,
EventListener<? super T> listener)
Registers an event listener with the specified order for a specific event
class.
|
<T extends Event> |
registerListener(Object plugin,
TypeToken<T> eventType,
Order order,
EventListener<? super T> listener)
Registers an event listener with the specified order for a specific event
TypeToken . |
void |
registerListeners(Object plugin,
Object obj)
|
void |
unregisterListeners(Object obj)
Un-registers an object from receiving
Event s. |
void |
unregisterPluginListeners(Object plugin)
Un-registers all event listeners of a plugin.
|
void registerListeners(Object plugin, Object obj)
Event
methods annotated with @Listener
in the
specified object.
Only methods that are public will be registered and the class must be public as well.
plugin
- The plugin instanceobj
- The objectIllegalArgumentException
- Thrown if plugin
is not a plugin
instance<T extends Event> void registerListener(Object plugin, Class<T> eventClass, EventListener<? super T> listener)
Normally, the annotation-based way in
registerListeners(Object, Object)
should be preferred over this way. This
method exists primarily to support dynamic event registration like needed
in scripting plugins.
T
- The type of the eventplugin
- The plugin instanceeventClass
- The event to listen tolistener
- The listener to receive the events<T extends Event> void registerListener(Object plugin, TypeToken<T> eventType, EventListener<? super T> listener)
TypeToken
.
Normally, the annotation-based way in
registerListeners(Object, Object)
should be preferred over this way. This
method exists primarily to support dynamic event registration like needed
in scripting plugins.
T
- The type of the eventplugin
- The plugin instanceeventType
- The event to listen tolistener
- The listener to receive the events<T extends Event> void registerListener(Object plugin, Class<T> eventClass, Order order, EventListener<? super T> listener)
Normally, the annotation-based way in
registerListeners(Object, Object)
should be preferred over this way. This
method exists primarily to support dynamic event registration like needed
in scripting plugins.
T
- The type of the eventplugin
- The plugin instanceeventClass
- The event to listen toorder
- The order the listener will get called atlistener
- The listener to receive the events<T extends Event> void registerListener(Object plugin, TypeToken<T> eventType, Order order, EventListener<? super T> listener)
TypeToken
.
Normally, the annotation-based way in
registerListeners(Object, Object)
should be preferred over this way. This
method exists primarily to support dynamic event registration like needed
in scripting plugins.
T
- The type of the eventplugin
- The plugin instanceeventType
- The event to listen toorder
- The order the listener will get called atlistener
- The listener to receive the events<T extends Event> void registerListener(Object plugin, Class<T> eventClass, Order order, boolean beforeModifications, EventListener<? super T> listener)
Normally, the annotation-based way in
registerListeners(Object, Object)
should be preferred over this way. This
method exists primarily to support dynamic event registration like needed
in scripting plugins.
T
- The type of the eventplugin
- The plugin instanceeventClass
- The event to listen toorder
- The order the listener will get called atbeforeModifications
- Whether to call the listener before other
server modificationslistener
- The listener to receive the events<T extends Event> void registerListener(Object plugin, TypeToken<T> eventType, Order order, boolean beforeModifications, EventListener<? super T> listener)
Normally, the annotation-based way in
registerListeners(Object, Object)
should be preferred over this way. This
method exists primarily to support dynamic event registration like needed
in scripting plugins.
T
- The type of the eventplugin
- The plugin instanceeventType
- The event to listen toorder
- The order the listener will get called atbeforeModifications
- Whether to call the listener before other
server modificationslistener
- The listener to receive the eventsvoid unregisterListeners(Object obj)
Event
s.obj
- The objectvoid unregisterPluginListeners(Object plugin)
plugin
- The plugin instance