Class EventInvokerImpl<T>

java.lang.Object
net.ixdarklord.coolcatcore.internal.event.EventInvokerImpl<T>
All Implemented Interfaces:
EventInvoker<T>

public final class EventInvokerImpl<T> extends Object implements EventInvoker<T>
  • Method Details

    • create

      public static <T> EventInvoker<T> create(Class<T> type, @Nullable @Nullable Function<List<T>,T> combiner)
    • lookup

      public static <T> EventInvoker<T> lookup(Class<T> type)
    • type

      public Class<T> type()
      Description copied from interface: EventInvoker
      The listener type identifying this event.
      Specified by:
      type in interface EventInvoker<T>
    • register

      public void register(EventPhase phase, T listener)
      Description copied from interface: EventInvoker
      Adds a listener in the given phase.
      Specified by:
      register in interface EventInvoker<T>
    • unregister

      public boolean unregister(T listener)
      Description copied from interface: EventInvoker
      Removes a listener, from whichever phase it was added to.
      Specified by:
      unregister in interface EventInvoker<T>
      Returns:
      whether it was registered
    • hasListeners

      public boolean hasListeners()
      Specified by:
      hasListeners in interface EventInvoker<T>
      Returns:
      whether the event has any listeners, so a loader can skip building its arguments
    • invoker

      public T invoker()
      Description copied from interface: EventInvoker
      Fires the event: calls every listener as the event combines them.
      Specified by:
      invoker in interface EventInvoker<T>