Package org.geysermc.event.bus.impl
Class EventBusImpl<E,S extends Subscriber<? extends E>>
java.lang.Object
org.geysermc.event.bus.impl.EventBusImpl<E,S>
public abstract class EventBusImpl<E,S extends Subscriber<? extends E>>
extends Object
implements EventBus<E,S>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static <T extends U,U>
Set<T>castGenericNullableSet(@Nullable Set<U> o) protected <T extends Subscriber<U>,U>
Set<T>eventSubscribers(Class<U> eventType) protected <T extends E>
voidfindSubscriptions(@NonNull Object listener, TriConsumer<Class<T>, Subscribe, BiConsumer<Object, T>> consumer) Fires the given event and log all exceptions that occur while executing this event.fireSilently(E event) Fires the given event silently.protected abstract <T extends E,B extends Subscriber<T>>
BmakeSubscription(@NonNull Class<T> eventClass, @NonNull Consumer<T> handler, @NonNull PostOrder postOrder) protected abstract <H,T extends E, B extends Subscriber<T>>
BmakeSubscription(@NonNull Class<T> eventClass, @NonNull Subscribe subscribe, @NonNull H listener, @NonNull BiConsumer<H, T> handler) voidRegisters events for the given listener.protected <T extends E>
voidsortedSubscribers(Class<?> eventClass) <T extends E,U extends Subscriber<T>>
@NonNull U<T extends E,U extends Subscriber<T>>
@NonNull Usubscribe(@NonNull Class<T> eventClass, @NonNull Consumer<T> consumer, @NonNull PostOrder postOrder) <T extends E>
@NonNull Set<? extends Subscriber<T>>subscribers(@NonNull Class<T> eventClass) Gets the subscriptions for the given event class.voidvoidunsubscribe(S subscription) Unsubscribes the givenSubscriber.protected voidprotected voidunsubscribeMany(Iterable<S> subscriptions) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.geysermc.event.bus.BaseBus
fire, fireSilently, unsubscribe
-
Constructor Details
-
EventBusImpl
public EventBusImpl()
-
-
Method Details
-
makeSubscription
protected abstract <H,T extends E, B makeSubscriptionB extends Subscriber<T>> (@NonNull Class<T> eventClass, @NonNull Subscribe subscribe, @NonNull H listener, @NonNull BiConsumer<H, T> handler) -
makeSubscription
protected abstract <T extends E,B extends Subscriber<T>> B makeSubscription(@NonNull Class<T> eventClass, @NonNull Consumer<T> handler, @NonNull PostOrder postOrder) -
register
Description copied from interface:EventBusRegisters events for the given listener. -
subscribe
public <T extends E,U extends Subscriber<T>> @NonNull U subscribe(@NonNull Class<T> eventClass, @NonNull Consumer<T> consumer) -
subscribe
public <T extends E,U extends Subscriber<T>> @NonNull U subscribe(@NonNull Class<T> eventClass, @NonNull Consumer<T> consumer, @NonNull PostOrder postOrder) -
unregisterAll
public void unregisterAll()- Specified by:
unregisterAllin interfaceEventBus<E,S extends Subscriber<? extends E>>
-
subscribers
public <T extends E> @NonNull Set<? extends Subscriber<T>> subscribers(@NonNull Class<T> eventClass) Description copied from interface:BaseBusGets the subscriptions for the given event class.- Specified by:
subscribersin interfaceBaseBus<E,S extends Subscriber<? extends E>> - Type Parameters:
T- the value- Parameters:
eventClass- the event class- Returns:
- the subscriptions for the event class
-
register
-
findSubscriptions
protected <T extends E> void findSubscriptions(@NonNull Object listener, TriConsumer<Class<T>, Subscribe, BiConsumer<Object, T>> consumer) -
unsubscribe
Description copied from interface:BaseBusUnsubscribes the givenSubscriber.- Specified by:
unsubscribein interfaceBaseBus<E,S extends Subscriber<? extends E>> - Parameters:
subscription- the event subscription
-
unsubscribeMany
-
unsubscribeAll
protected void unsubscribeAll() -
fire
Description copied from interface:BaseBusFires the given event and log all exceptions that occur while executing this event.- Specified by:
firein interfaceBaseBus<E,S extends Subscriber<? extends E>> - Parameters:
event- the event to fire
-
fireSilently
Description copied from interface:BaseBusFires the given event silently.- Specified by:
fireSilentlyin interfaceBaseBus<E,S extends Subscriber<? extends E>> - Parameters:
event- the event to fire- Returns:
- the result of firing the given event
-
sortedSubscribers
-
eventSubscribers
-
castGenericNullableSet
-