Package net.dv8tion.jda.api.hooks
Class AnnotatedEventManager
- java.lang.Object
-
- net.dv8tion.jda.api.hooks.AnnotatedEventManager
-
- All Implemented Interfaces:
IEventManager
public class AnnotatedEventManager extends java.lang.Object implements IEventManager
Implementation forIEventManager
which checks forSubscribeEvent
annotations on both static and member methods.Listeners for this manager do not need to implement
EventListener
Examplepublic class Foo { @SubscribeEvent public void onMsg(MessageReceivedEvent event) { System.out.printf("%s: %s\n", event.getAuthor().getName(), event.getMessage().getContentDisplay()); } }
- See Also:
InterfacedEventManager
,IEventManager
,SubscribeEvent
-
-
Constructor Summary
Constructors Constructor Description AnnotatedEventManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.Object>
getRegisteredListeners()
The currently registered listenersvoid
handle(GenericEvent event)
Handles the providedGenericEvent
.void
register(java.lang.Object listener)
Registers the specified listener
Accepted types may be specified by implementationsvoid
unregister(java.lang.Object listener)
Removes the specified listener
-
-
-
Method Detail
-
register
public void register(@Nonnull java.lang.Object listener)
Description copied from interface:IEventManager
Registers the specified listener
Accepted types may be specified by implementations- Specified by:
register
in interfaceIEventManager
- Parameters:
listener
- A listener object
-
unregister
public void unregister(@Nonnull java.lang.Object listener)
Description copied from interface:IEventManager
Removes the specified listener- Specified by:
unregister
in interfaceIEventManager
- Parameters:
listener
- The listener object to remove
-
getRegisteredListeners
@Nonnull public java.util.List<java.lang.Object> getRegisteredListeners()
Description copied from interface:IEventManager
The currently registered listeners- Specified by:
getRegisteredListeners
in interfaceIEventManager
- Returns:
- A list of listeners that have already been registered
-
handle
public void handle(@Nonnull GenericEvent event)
Description copied from interface:IEventManager
Handles the providedGenericEvent
.
How this is handled is specified by the implementation.An implementation should not throw exceptions.
- Specified by:
handle
in interfaceIEventManager
- Parameters:
event
- The event to handle
-
-