Interface IEventRegistry


public interface IEventRegistry
Holds all information pertaining to events and event buses.

An instance of this class can be obtained through ICraftTweakerRegistry.

Since:
11.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> IEventBus<T>
    busOf(com.google.common.reflect.TypeToken<T> eventType)
    Obtains the IEventBus associated to the given event type, represented as a TypeToken.
    default <T> IEventBus<T>
    busOf(Class<T> clazz)
    Obtains the IEventBus associated to the given event type, represented as a Class.
  • Method Details

    • busOf

      <T> IEventBus<T> busOf(com.google.common.reflect.TypeToken<T> eventType)
      Obtains the IEventBus associated to the given event type, represented as a TypeToken.

      Usage of this API is discouraged as the lookup is slower than accessing the bus for the event directly through Java code. This entry point is provided solely for automatic discovery for the ZenCode script interface.

      Type Parameters:
      T - The type of the event.
      Parameters:
      eventType - The type of the event whose bus should be looked up.
      Returns:
      The IEventBus associated to it.
      Throws:
      IllegalArgumentException - If the given event type does not exist.
      Since:
      11.0.0
    • busOf

      default <T> IEventBus<T> busOf(Class<T> clazz)
      Obtains the IEventBus associated to the given event type, represented as a Class.

      Usage of this API is discouraged as the lookup is slower than accessing the bus for the event directly through Java code. This entry point is provided solely for automatic discovery for the ZenCode script interface.

      Type Parameters:
      T - The type of the event.
      Parameters:
      clazz - The type of the event whose bus should be looked up.
      Returns:
      The IEventBus associated to it.
      Throws:
      IllegalArgumentException - If the given event type does not exist.
      Since:
      11.0.0