Interface EventHandler


public interface EventHandler
Handles the registration and execution of events.
  • Method Summary

    Modifier and Type
    Method
    Description
    call(E event)
    Calls the event.
    <E> void
    justCall(E event)
    Calls the event.
    <E> void
    register(@NotNull Plugin plugin, @NotNull Class<E> event, short eventOrder, @NotNull Consumer<E> eventConsumer)
    Registers an event listener consumer.
    default <E> void
    register(@NotNull Plugin plugin, @NotNull Class<E> event, @NotNull Consumer<E> eventConsumer)
    Registers an event listener consumer.
    void
    register(@NotNull Plugin plugin, @NotNull Object listener)
    Registers the event listener.
    void
    unregister(@NotNull Plugin plugin)
    Unregisters all listeners of a specific plugin
    void
    unregister(@NotNull Plugin plugin, @NotNull Object listener)
    Unregisters the specified listener.
  • Method Details

    • register

      void register(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Object listener)
      Registers the event listener.
      Parameters:
      plugin - the plugin that registers the event listener
      listener - the listener
      Since:
      1.0.0
    • register

      default <E> void register(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Class<E> event, @NotNull @NotNull Consumer<E> eventConsumer)
      Registers an event listener consumer.
      Type Parameters:
      E - the event class type
      Parameters:
      plugin - the plugin that registers the event listener
      event - the event class
      eventConsumer - the consumer that consumes the event on call
      Since:
      1.0.0
    • register

      <E> void register(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Class<E> event, short eventOrder, @NotNull @NotNull Consumer<E> eventConsumer)
      Registers an event listener consumer.
      Type Parameters:
      E - the event class type
      Parameters:
      plugin - the plugin that registers the event listener
      event - the event class
      eventOrder - the order
      eventConsumer - the consumer that consumes the event on call
      Since:
      1.0.0
    • unregister

      void unregister(@NotNull @NotNull Plugin plugin)
      Unregisters all listeners of a specific plugin
      Parameters:
      plugin - the plugin of the listeners
      Since:
      1.0.0
    • unregister

      void unregister(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Object listener)
      Unregisters the specified listener.
      Parameters:
      plugin - the plugin of the listener
      listener - the listener to unregister
      Since:
      1.0.0
    • call

      <E> CompletableFuture<E> call(E event)
      Calls the event.
      Type Parameters:
      E - the event type to call
      Parameters:
      event - the event to call
      Returns:
      a CompletableFuture with the called event.
      Since:
      1.0.0
    • justCall

      <E> void justCall(E event)
      Calls the event.
      Type Parameters:
      E - the event type to call
      Parameters:
      event - the event to call
      Since:
      1.0.0