Package net.dv8tion.jda.api.hooks
Interface IEventManager
- All Known Implementing Classes:
AnnotatedEventManager
,InterfacedEventManager
public interface IEventManager
An interface for JDA's EventManager system.
This should be registered in the
This should be registered in the
JDABuilder
JDA provides 2 implementations:
InterfacedEventManager
Simple implementation that allowsEventListener
instances as listeners.AnnotatedEventManager
An implementation that accepts any object and uses theSubscribeEvent
annotation to handle events.
The default event manager is InterfacedEventManager
Use JDABuilder.setEventManager(IEventManager)
to set the preferred event manager implementation.
You can only use one implementation per JDA instance!
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionThe currently registered listenersvoid
handle
(GenericEvent event) Handles the providedGenericEvent
.void
Registers the specified listener
Accepted types may be specified by implementationsvoid
unregister
(Object listener) Removes the specified listener
-
Method Details
-
register
Registers the specified listener
Accepted types may be specified by implementations- Parameters:
listener
- A listener object- Throws:
UnsupportedOperationException
- If the implementation does not support this method
-
unregister
Removes the specified listener- Parameters:
listener
- The listener object to remove- Throws:
UnsupportedOperationException
- If the implementation does not support this method
-
handle
Handles the providedGenericEvent
.
How this is handled is specified by the implementation.An implementation should not throw exceptions.
- Parameters:
event
- The event to handle
-
getRegisteredListeners
The currently registered listeners- Returns:
- A list of listeners that have already been registered
- Throws:
UnsupportedOperationException
- If the implementation does not support this method
-