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 Details

    • subscribe

      <T extends E, U extends OwnedSubscriber<O, T>> @NonNull U subscribe(@NonNull O owner, @NonNull Class<T> eventClass, @NonNull Consumer<T> consumer)
      Subscribes to the given event see Subscriber.

      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 to
      eventClass - the class of the event
      consumer - 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 Class<T> eventClass, @NonNull Consumer<T> consumer, @NonNull PostOrder postOrder)
      Subscribes to the given event see Subscriber.

      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 to
      eventClass - the class of the event
      consumer - the consumer for handling the event
      postOrder - the order of the subscriber
      Returns:
      the event subscription
    • register

      void register(@NonNull O owner, @NonNull Object listener)
      Registers events for the given listener.
      Parameters:
      owner - the extension registering the event
      listener - the listener
    • unregisterAll

      void unregisterAll(@NonNull O owner)
      Unregisters all events from a given owner.
      Parameters:
      owner - the extension
    • subscribers

      <T extends E> @NonNull Set<? extends OwnedSubscriber<O,T>> subscribers(@NonNull Class<T> eventClass)
      Description copied from interface: BaseBus
      Gets the subscriptions for the given event class.
      Specified by:
      subscribers in interface BaseBus<O,E>
      Type Parameters:
      T - the value
      Parameters:
      eventClass - the event class
      Returns:
      the subscriptions for the event class