Package org.spongepowered.api.event
Interface EventManager
public interface EventManager
Manages the registration of event listeners and the dispatching of events.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Calls anEvent
to all listeners that listen to it.<E extends Event>
EventManagerregisterListener
(EventListenerRegistration<E> registration) Submits a newlistener registration
to this manager.registerListeners
(org.spongepowered.plugin.PluginContainer plugin, Object obj) registerListeners
(org.spongepowered.plugin.PluginContainer plugin, Object obj, MethodHandles.Lookup lookup) Un-registers an object from receivingEvent
s.
-
Method Details
-
registerListener
Submits a newlistener registration
to this manager.- Type Parameters:
E
- The event type- Parameters:
registration
- The registration- Returns:
- This manager, for fluency
-
registerListeners
RegistersEvent
methods annotated with @Listener
in the specified object.This will not include any methods declared in supertypes, but will test for private and package-private listener methods.
- Parameters:
plugin
- The plugin containerobj
- The object- Returns:
- This manager, for fluency
-
registerListeners
EventManager registerListeners(org.spongepowered.plugin.PluginContainer plugin, Object obj, MethodHandles.Lookup lookup) RegistersEvent
methods annotated with @Listener
in the specified object.This will not include any methods declared in supertypes, but will test for private and package-private listener methods.
The provided lookup will be used for privileged access to the listener object.
- Parameters:
plugin
- The plugin containerobj
- The objectlookup
- The lookup with which to access the listener object- Returns:
- This manager, for fluency
-
unregisterListeners
Un-registers an object from receivingEvent
s.If the provided object is a
plugin
, all events associated with that plugin will be unregistered.- Parameters:
obj
- The object- Returns:
- This manager, for fluency
-
post
Calls anEvent
to all listeners that listen to it.- Parameters:
event
- The event- Returns:
- True if cancelled, false if not
-