Class EventInvokerImpl<T>
java.lang.Object
net.ixdarklord.coolcatcore.internal.event.EventInvokerImpl<T>
- All Implemented Interfaces:
EventInvoker<T>
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> EventInvoker<T>A new event whose invoker is built bycombinerfrom the current listeners, in phase order.booleanbooleanhasListeners(EventPhase.Band band) invoker()Fires the event: calls every listener as the event combines them.invoker(EventPhase.Band band) Fires the event for the listeners of one band only, in phase order: what a loader hook calls from each of its places (before, among and after other mods' listeners).static <T> EventInvoker<T>The event with this listener type.voidregister(EventPhase phase, T listener) Adds a listener in the given phase.type()The listener type identifying this event.booleanunregister(T listener) Removes a listener, from whichever phase it was added to.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.ixdarklord.coolcatcore.api.event.v2.core.EventInvoker
register
-
Method Details
-
create
public static <T> EventInvoker<T> create(Class<T> type, @Nullable @Nullable Function<List<T>, T> combiner) Description copied from interface:EventInvokerA new event whose invoker is built bycombinerfrom the current listeners, in phase order. The combiner runs again whenever the listeners change, so the invoker it returns can simply loop over the list. -
lookup
Description copied from interface:EventInvokerThe event with this listener type. The class declaring the listener type (for nested types) is initialised first, so its events exist. -
type
Description copied from interface:EventInvokerThe listener type identifying this event.- Specified by:
typein interfaceEventInvoker<T>
-
register
Description copied from interface:EventInvokerAdds a listener in the given phase. For events whose loader hook fires eachEventPhase.Bandat its own place,EventPhase.FIRSTalso runs before other mods' own listeners of the game event andEventPhase.LASTafter them.- Specified by:
registerin interfaceEventInvoker<T>
-
unregister
Description copied from interface:EventInvokerRemoves a listener, from whichever phase it was added to.- Specified by:
unregisterin interfaceEventInvoker<T>- Returns:
- whether it was registered
-
hasListeners
public boolean hasListeners()- Specified by:
hasListenersin interfaceEventInvoker<T>- Returns:
- whether the event has any listeners, so a loader can skip building its arguments
-
hasListeners
- Specified by:
hasListenersin interfaceEventInvoker<T>- Returns:
- whether the event has listeners in phases of this band
-
invoker
Description copied from interface:EventInvokerFires the event: calls every listener as the event combines them.- Specified by:
invokerin interfaceEventInvoker<T>
-
invoker
Description copied from interface:EventInvokerFires the event for the listeners of one band only, in phase order: what a loader hook calls from each of its places (before, among and after other mods' listeners). The three bands together areEventInvoker.invoker().- Specified by:
invokerin interfaceEventInvoker<T>
-