Interface Event<L>

Type Parameters:
L - Event listener type.
All Known Implementing Classes:
Event.Impl

public interface Event<L>
Represents an event that can be fired to invoke registered listeners.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    Main Event implementation.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    addListener(L listener)
    Adds a listener to this Event, that is to be invoked when this Event is fired.
    void
    Removes all listeners from this Event, so that no listeners will be invoked when this Event is fired.
    boolean
    containsListener(L listener)
    Checks if a listener is added to this Event.
    Returns the invoker of this Event, which is used to fire this Event and invoke all registered listeners.
    boolean
    removeListener(L listener)
    Removes a listener from this Event, so that it will no longer be invoked when this Event is fired.
  • Method Details

    • invoker

      @NotNull L invoker()
      Returns the invoker of this Event, which is used to fire this Event and invoke all registered listeners.
    • addListener

      boolean addListener(@NotNull L listener) throws NullPointerException
      Adds a listener to this Event, that is to be invoked when this Event is fired.
      Parameters:
      listener - The listener that will be invoked when this Event is fired.
      Returns:
      false if the listener was already registered, true otherwise.
      Throws:
      NullPointerException - If the argument is null.
    • removeListener

      boolean removeListener(@NotNull L listener) throws NullPointerException
      Removes a listener from this Event, so that it will no longer be invoked when this Event is fired.
      Parameters:
      listener - The listener to be removed.
      Returns:
      true if the listener was registered before removal, false otherwise.
      Throws:
      NullPointerException - If the argument is null.
    • clearListeners

      void clearListeners()
      Removes all listeners from this Event, so that no listeners will be invoked when this Event is fired.
    • containsListener

      boolean containsListener(@NotNull L listener) throws NullPointerException
      Checks if a listener is added to this Event.
      Parameters:
      listener - The listener to check for.
      Returns:
      true if the listener is added, false otherwise.
      Throws:
      NullPointerException - If the argument is null.