Class AnnotatedEventManager

All Implemented Interfaces:

public class AnnotatedEventManager extends Object implements IEventManager
Implementation for IEventManager which checks for SubscribeEvent annotations on both static and member methods.

Listeners for this manager do not need to implement EventListener

 public class Foo
     public void onMsg(MessageReceivedEvent event)
         System.out.printf("%s: %s\n", event.getAuthor().getName(), event.getMessage().getContentDisplay());
See Also:
  • Constructor Details

    • AnnotatedEventManager

      public AnnotatedEventManager()
  • Method Details

    • register

      public void register(@Nonnull Object listener)
      Description copied from interface: IEventManager
      Registers the specified listener
      Accepted types may be specified by implementations
      Specified by:
      register in interface IEventManager
      listener - A listener object
    • unregister

      public void unregister(@Nonnull Object listener)
      Description copied from interface: IEventManager
      Removes the specified listener
      Specified by:
      unregister in interface IEventManager
      listener - The listener object to remove
    • getRegisteredListeners

      @Nonnull public List<Object> getRegisteredListeners()
      Description copied from interface: IEventManager
      The currently registered listeners
      Specified by:
      getRegisteredListeners in interface IEventManager
      A list of listeners that have already been registered
    • handle

      public void handle(@Nonnull GenericEvent event)
      Description copied from interface: IEventManager
      Handles the provided GenericEvent.
      How this is handled is specified by the implementation.

      An implementation should not throw exceptions.

      Specified by:
      handle in interface IEventManager
      event - The event to handle