Package org.geysermc.event.bus
Interface OwnedEventBus<O,E,S extends OwnedSubscriber<O,? extends E>>
-
- All Superinterfaces:
BaseBus<E,S>
- All Known Implementing Classes:
OwnedEventBusImpl
public interface OwnedEventBus<O,E,S extends OwnedSubscriber<O,? extends E>> extends BaseBus<E,S>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidregister(@NonNull O owner, @NonNull java.lang.Object listener)Registers events for the given listener.<T extends E,U extends OwnedSubscriber<O,T>>
@NonNull Usubscribe(@NonNull O owner, @NonNull java.lang.Class<T> eventClass, @NonNull java.util.function.Consumer<T> consumer)Subscribes to the given event seeSubscriber.<T extends E,U extends OwnedSubscriber<O,T>>
@NonNull Usubscribe(@NonNull O owner, @NonNull java.lang.Class<T> eventClass, @NonNull java.util.function.Consumer<T> consumer, @NonNull PostOrder postOrder)Subscribes to the given event seeSubscriber.<T extends E>
@NonNull java.util.Set<? extends OwnedSubscriber<O,T>>subscribers(@NonNull java.lang.Class<T> eventClass)Gets the subscriptions for the given event class.voidunregisterAll(@NonNull O owner)Unregisters all events from a given owner.-
Methods inherited from interface org.geysermc.event.bus.BaseBus
fire, fireSilently, unsubscribe
-
-
-
-
Method Detail
-
subscribe
<T extends E,U extends OwnedSubscriber<O,T>> @NonNull U subscribe(@NonNull O owner, @NonNull java.lang.Class<T> eventClass, @NonNull java.util.function.Consumer<T> consumer)
Subscribes to the given event seeSubscriber.The difference between this method and is that this method takes in an extension parameter which allows for the event to be unsubscribed upon extension disable and reloads.
- Type Parameters:
T- the event class- Parameters:
owner- the extension to subscribe the event toeventClass- the class of the eventconsumer- the consumer for handling the event- Returns:
- the event subscription
-
subscribe
<T extends E,U extends OwnedSubscriber<O,T>> @NonNull U subscribe(@NonNull O owner, @NonNull java.lang.Class<T> eventClass, @NonNull java.util.function.Consumer<T> consumer, @NonNull PostOrder postOrder)
Subscribes to the given event seeSubscriber.The difference between this method and is that this method takes in an extension parameter which allows for the event to be unsubscribed upon extension disable and reloads.
- Type Parameters:
T- the event class- Parameters:
owner- the extension to subscribe the event toeventClass- the class of the eventconsumer- the consumer for handling the eventpostOrder- the order of the subscriber- Returns:
- the event subscription
-
register
void register(@NonNull O owner, @NonNull java.lang.Object listener)
Registers events for the given listener.- Parameters:
owner- the extension registering the eventlistener- the listener
-
unregisterAll
void unregisterAll(@NonNull O owner)
Unregisters all events from a given owner.- Parameters:
owner- the extension
-
subscribers
<T extends E> @NonNull java.util.Set<? extends OwnedSubscriber<O,T>> subscribers(@NonNull java.lang.Class<T> eventClass)
Description copied from interface:BaseBusGets the subscriptions for the given event class.- Specified by:
subscribersin interfaceBaseBus<O,E>- Type Parameters:
T- the value- Parameters:
eventClass- the event class- Returns:
- the subscriptions for the event class
-
-