Interface IEventRegistrationHandler


public interface IEventRegistrationHandler
Manages the registration of additional information for events and event buses.

Refer to the IEventBus documentation for more information.

Since:
11.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> void
    registerEventMapping(com.google.common.reflect.TypeToken<T> event, IEventBus<T> bus)
    Registers a mapping between an event type and its corresponding bus.
  • Method Details

    • registerEventMapping

      <T> void registerEventMapping(com.google.common.reflect.TypeToken<T> event, IEventBus<T> bus)
      Registers a mapping between an event type and its corresponding bus.

      This mapping is used by the ZenCode script interface to look-up associations between events and the corresponding buses to perform registration and removal tasks. Not all event buses have to be registered with this method: as a matter of fact CraftTweaker does not require registration of buses. Nevertheless, this step is mandatory if the event bus is supposed to be accessible through the ZenCode scripting interface.

      Type Parameters:
      T - The type of the event.
      Parameters:
      event - The TypeToken representing the event for which this mapping is for.
      bus - The IEventBus associated to this event.
      Throws:
      IllegalArgumentException - If the same event type has had a bus already associated to it.
      Since:
      11.0.0