Class InterfacedEventManager

java.lang.Object
net.dv8tion.jda.api.hooks.InterfacedEventManager
All Implemented Interfaces:
IEventManager

public class InterfacedEventManager extends Object implements IEventManager
An IEventManager implementation that uses the EventListener interface for event listeners.

This only accepts listeners that implement EventListener
An adapter implementation is ListenerAdapter which provides methods for each individual Event.

This is the default IEventManager used by JDA

See Also:
  • Constructor Details

    • InterfacedEventManager

      public InterfacedEventManager()
  • Method Details

    • register

      public void register(@Nonnull Object listener)
      Registers the specified listener
      Accepted types may be specified by implementations
      Specified by:
      register in interface IEventManager
      Parameters:
      listener - A listener object
      Throws:
      IllegalArgumentException - If the provided listener does not implement EventListener
    • unregister

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

      @Nonnull public @Unmodifiable List<Object> getRegisteredListeners()
      Description copied from interface: IEventManager
      The currently registered listeners
      Specified by:
      getRegisteredListeners in interface IEventManager
      Returns:
      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
      Parameters:
      event - The event to handle