Class DefaultEventBus

java.lang.Object
com.minecolonies.api.eventbus.DefaultEventBus
All Implemented Interfaces:
EventBus

public class DefaultEventBus extends Object implements EventBus
Default implementation of the mod event bus.
  • Constructor Details

    • DefaultEventBus

      public DefaultEventBus()
  • Method Details

    • subscribe

      public <T extends IModEvent> void subscribe(@NotNull @NotNull Class<T> eventType, @NotNull @NotNull EventBus.EventHandler<T> handler)
      Description copied from interface: EventBus
      Subscribe to the given event type, providing a handler function.
      Specified by:
      subscribe in interface EventBus
      Type Parameters:
      T - the generic type of the event class.
      Parameters:
      eventType - the event class type.
      handler - the handler function handling the event logic.
    • post

      public void post(@NotNull @NotNull IModEvent event)
      Description copied from interface: EventBus
      Posts a new event on the event bus for the given type.
      Specified by:
      post in interface EventBus
      Parameters:
      event - the event to send.