IEventManager
public class AnnotatedEventManager extends java.lang.Object implements IEventManager
IEventManager
which checks for SubscribeEvent
annotations on both
static and member methods.
Listeners for this manager do not need to implement EventListener
Example
public class Foo
{
@SubscribeEvent
public void onMsg(MessageReceivedEvent event)
{
System.out.printf("%s: %s\n", event.getAuthor().getName(), event.getMessage().getContentDisplay());
}
}
InterfacedEventManager
,
IEventManager
,
SubscribeEvent
Constructor | Description |
---|---|
AnnotatedEventManager() |
Modifier and Type | Method | Description |
---|---|---|
java.util.List<java.lang.Object> |
getRegisteredListeners() |
The currently registered listeners
|
void |
handle(Event event) |
Handles the provided
Event . |
void |
register(java.lang.Object listener) |
Registers the specified listener
Accepted types may be specified by implementations |
void |
unregister(java.lang.Object listener) |
Removes the specified listener
|
public void register(java.lang.Object listener)
IEventManager
register
in interface IEventManager
listener
- A listener objectpublic void unregister(java.lang.Object listener)
IEventManager
unregister
in interface IEventManager
listener
- The listener object to removepublic java.util.List<java.lang.Object> getRegisteredListeners()
IEventManager
getRegisteredListeners
in interface IEventManager
public void handle(Event event)
IEventManager
Event
.
How this is handled is specified by the implementation.handle
in interface IEventManager
event
- The event to handle