Class EventRegistry

java.lang.Object
com.hypixel.hytale.registry.Registry<EventRegistration<?,?>>
com.hypixel.hytale.event.EventRegistry
All Implemented Interfaces:
IEventRegistry

public class EventRegistry extends Registry<EventRegistration<?,?>> implements IEventRegistry
An event registry that allows registering event listeners with various options.
  • Constructor Details

    • EventRegistry

      public EventRegistry(@Nonnull List<BooleanConsumer> registrations, @Nonnull BooleanSupplier precondition, @Nullable String preconditionMessage, @Nonnull IEventRegistry parent)
      Default Constructor for a EventRegistry instance.
      Parameters:
      registrations - The list of registrations for this registry.
      precondition - The precondition for this registry.
      preconditionMessage - The precondition message for this registry.
      parent - The parent event registry for this registry.
  • Method Details

    • register

      public <KeyType, EventType extends IBaseEvent<KeyType>> EventRegistration<KeyType, EventType> register(@Nonnull EventRegistration<KeyType, EventType> evt)
      Called to register an event registration.
      Type Parameters:
      KeyType - The key type filter for this event call.
      EventType - The event type.
      Parameters:
      evt - The event registration to register.
      Returns:
      the registered event registration.
    • register

      public <EventType extends IBaseEvent<Void>> EventRegistration<Void, EventType> register(@Nonnull Class<? super EventType> eventClass, @Nonnull Consumer<EventType> consumer)
      Description copied from interface: IEventRegistry
      Called to register an event listener for the given event class, with the given consumer.
      Specified by:
      register in interface IEventRegistry
      Type Parameters:
      EventType - The type of the event.
      Parameters:
      eventClass - The event class to register the listener for.
      consumer - The consumer to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • register

      public <EventType extends IBaseEvent<Void>> EventRegistration<Void, EventType> register(@Nonnull EventPriority priority, @Nonnull Class<? super EventType> eventClass, @Nonnull Consumer<EventType> consumer)
      Description copied from interface: IEventRegistry
      Called to register an event listener for the given event class, with the given priority and consumer.
      Specified by:
      register in interface IEventRegistry
      Type Parameters:
      EventType - The type of the event.
      Parameters:
      priority - The priority of the event listener.
      eventClass - The event class to register the listener for.
      consumer - The consumer to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • register

      public <EventType extends IBaseEvent<Void>> EventRegistration<Void, EventType> register(short priority, @Nonnull Class<? super EventType> eventClass, @Nonnull Consumer<EventType> consumer)
      Description copied from interface: IEventRegistry
      Called to register an event listener for the given event class, with the given priority and consumer.
      Specified by:
      register in interface IEventRegistry
      Type Parameters:
      EventType - The type of the event.
      Parameters:
      priority - The priority of the event listener.
      eventClass - The event class to register the listener for.
      consumer - The consumer to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • register

      public <KeyType, EventType extends IBaseEvent<KeyType>> EventRegistration<KeyType, EventType> register(@Nonnull Class<? super EventType> eventClass, @Nonnull KeyType key, @Nonnull Consumer<EventType> consumer)
      Description copied from interface: IEventRegistry
      Called to register an event listener for the given event class and key, with the given consumer.
      Specified by:
      register in interface IEventRegistry
      Type Parameters:
      KeyType - The key type.
      EventType - The type of the event.
      Parameters:
      eventClass - The event class to register the listener for.
      key - The key for the event.
      consumer - The consumer to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • register

      public <KeyType, EventType extends IBaseEvent<KeyType>> EventRegistration<KeyType, EventType> register(@Nonnull EventPriority priority, @Nonnull Class<? super EventType> eventClass, @Nonnull KeyType key, @Nonnull Consumer<EventType> consumer)
      Description copied from interface: IEventRegistry
      Called to register an event listener for the given event class and key, with the given priority and consumer.
      Specified by:
      register in interface IEventRegistry
      Type Parameters:
      KeyType - The key type.
      EventType - The type of the event.
      Parameters:
      priority - The priority of the event listener.
      eventClass - The event class to register the listener for.
      key - The key for the event.
      consumer - The consumer to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • register

      public <KeyType, EventType extends IBaseEvent<KeyType>> EventRegistration<KeyType, EventType> register(short priority, @Nonnull Class<? super EventType> eventClass, @Nonnull KeyType key, @Nonnull Consumer<EventType> consumer)
      Description copied from interface: IEventRegistry
      Called to register an event listener for the given event class and key, with the given priority and consumer.
      Specified by:
      register in interface IEventRegistry
      Type Parameters:
      KeyType - The key type.
      EventType - The type of the event.
      Parameters:
      priority - The priority of the event listener.
      eventClass - The event class to register the listener for.
      key - The key for the event.
      consumer - The consumer to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • registerAsync

      public <EventType extends IAsyncEvent<Void>> EventRegistration<Void, EventType> registerAsync(@Nonnull Class<? super EventType> eventClass, @Nonnull Function<CompletableFuture<EventType>, CompletableFuture<EventType>> function)
      Description copied from interface: IEventRegistry
      Called to register an async event listener for the given event class, with the given function.
      Specified by:
      registerAsync in interface IEventRegistry
      Type Parameters:
      EventType - The type of the event.
      Parameters:
      eventClass - The event class to register the listener for.
      function - The function to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • registerAsync

      public <EventType extends IAsyncEvent<Void>> EventRegistration<Void, EventType> registerAsync(@Nonnull EventPriority priority, @Nonnull Class<? super EventType> eventClass, @Nonnull Function<CompletableFuture<EventType>, CompletableFuture<EventType>> function)
      Description copied from interface: IEventRegistry
      Called to register an async event listener for the given event class, with the given priority and function.
      Specified by:
      registerAsync in interface IEventRegistry
      Type Parameters:
      EventType - The type of the event.
      Parameters:
      priority - The priority of the event listener.
      eventClass - The event class to register the listener for.
      function - The function to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • registerAsync

      public <EventType extends IAsyncEvent<Void>> EventRegistration<Void, EventType> registerAsync(short priority, @Nonnull Class<? super EventType> eventClass, @Nonnull Function<CompletableFuture<EventType>, CompletableFuture<EventType>> function)
      Description copied from interface: IEventRegistry
      Called to register an async event listener for the given event class, with the given priority and function.
      Specified by:
      registerAsync in interface IEventRegistry
      Type Parameters:
      EventType - The type of the event.
      Parameters:
      priority - The priority of the event listener.
      eventClass - The event class to register the listener for.
      function - The function to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • registerAsync

      public <KeyType, EventType extends IAsyncEvent<KeyType>> EventRegistration<KeyType, EventType> registerAsync(@Nonnull Class<? super EventType> eventClass, @Nonnull KeyType key, @Nonnull Function<CompletableFuture<EventType>, CompletableFuture<EventType>> function)
      Description copied from interface: IEventRegistry
      Called to register an async event listener for the given event class and key, with the given function.
      Specified by:
      registerAsync in interface IEventRegistry
      Type Parameters:
      KeyType - The key type.
      EventType - The type of the event.
      Parameters:
      eventClass - The event class to register the listener for.
      key - The key for the event.
      function - The function to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • registerAsync

      public <KeyType, EventType extends IAsyncEvent<KeyType>> EventRegistration<KeyType, EventType> registerAsync(@Nonnull EventPriority priority, Class<? super EventType> eventClass, @Nonnull KeyType key, @Nonnull Function<CompletableFuture<EventType>, CompletableFuture<EventType>> function)
      Description copied from interface: IEventRegistry
      Called to register an async event listener for the given event class and key, with the given priority and function.
      Specified by:
      registerAsync in interface IEventRegistry
      Type Parameters:
      KeyType - The key type.
      EventType - The type of the event.
      Parameters:
      priority - The priority of the event listener.
      eventClass - The event class to register the listener for.
      key - The key for the event.
      function - The function to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • registerAsync

      public <KeyType, EventType extends IAsyncEvent<KeyType>> EventRegistration<KeyType, EventType> registerAsync(short priority, @Nonnull Class<? super EventType> eventClass, @Nonnull KeyType key, @Nonnull Function<CompletableFuture<EventType>, CompletableFuture<EventType>> function)
      Description copied from interface: IEventRegistry
      Called to register an async event listener for the given event class and key, with the given priority and function.
      Specified by:
      registerAsync in interface IEventRegistry
      Type Parameters:
      KeyType - The key type.
      EventType - The type of the event.
      Parameters:
      priority - The priority of the event listener.
      eventClass - The event class to register the listener for.
      key - The key for the event.
      function - The function to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • registerGlobal

      public <KeyType, EventType extends IBaseEvent<KeyType>> EventRegistration<KeyType, EventType> registerGlobal(@Nonnull Class<? super EventType> eventClass, @Nonnull Consumer<EventType> consumer)
      Description copied from interface: IEventRegistry
      Called to register a global event listener for the given event class, with the given consumer.
      Specified by:
      registerGlobal in interface IEventRegistry
      Type Parameters:
      KeyType - The key type.
      EventType - The type of the event.
      Parameters:
      eventClass - The event class to register the listener for.
      consumer - The consumer to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • registerGlobal

      public <KeyType, EventType extends IBaseEvent<KeyType>> EventRegistration<KeyType, EventType> registerGlobal(@Nonnull EventPriority priority, @Nonnull Class<? super EventType> eventClass, @Nonnull Consumer<EventType> consumer)
      Description copied from interface: IEventRegistry
      Called to register a global event listener for the given event class, with the given priority and consumer.
      Specified by:
      registerGlobal in interface IEventRegistry
      Type Parameters:
      KeyType - The key type.
      EventType - The type of the event.
      Parameters:
      priority - The priority of the event listener.
      eventClass - The event class to register the listener for.
      consumer - The consumer to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • registerGlobal

      public <KeyType, EventType extends IBaseEvent<KeyType>> EventRegistration<KeyType, EventType> registerGlobal(short priority, @Nonnull Class<? super EventType> eventClass, @Nonnull Consumer<EventType> consumer)
      Description copied from interface: IEventRegistry
      Called to register a global event listener for the given event class, with the given priority and consumer.
      Specified by:
      registerGlobal in interface IEventRegistry
      Type Parameters:
      KeyType - The key type.
      EventType - The type of the event.
      Parameters:
      priority - The priority of the event listener.
      eventClass - The event class to register the listener for.
      consumer - The consumer to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • registerAsyncGlobal

      public <KeyType, EventType extends IAsyncEvent<KeyType>> EventRegistration<KeyType, EventType> registerAsyncGlobal(@Nonnull Class<? super EventType> eventClass, @Nonnull Function<CompletableFuture<EventType>, CompletableFuture<EventType>> function)
      Description copied from interface: IEventRegistry
      Called to register a global async event listener for the given event class, with the given function.
      Specified by:
      registerAsyncGlobal in interface IEventRegistry
      Type Parameters:
      KeyType - The key type.
      EventType - The type of the event.
      Parameters:
      eventClass - The event class to register the listener for.
      function - The function to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • registerAsyncGlobal

      public <KeyType, EventType extends IAsyncEvent<KeyType>> EventRegistration<KeyType, EventType> registerAsyncGlobal(@Nonnull EventPriority priority, @Nonnull Class<? super EventType> eventClass, @Nonnull Function<CompletableFuture<EventType>, CompletableFuture<EventType>> function)
      Description copied from interface: IEventRegistry
      Called to register a global async event listener for the given event class, with the given priority and function.
      Specified by:
      registerAsyncGlobal in interface IEventRegistry
      Type Parameters:
      KeyType - The key type.
      EventType - The type of the event.
      Parameters:
      priority - The priority of the event listener.
      eventClass - The event class to register the listener for.
      function - The function to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • registerAsyncGlobal

      public <KeyType, EventType extends IAsyncEvent<KeyType>> EventRegistration<KeyType, EventType> registerAsyncGlobal(short priority, @Nonnull Class<? super EventType> eventClass, @Nonnull Function<CompletableFuture<EventType>, CompletableFuture<EventType>> function)
      Description copied from interface: IEventRegistry
      Called to register a global async event listener for the given event class, with the given priority and function.
      Specified by:
      registerAsyncGlobal in interface IEventRegistry
      Type Parameters:
      KeyType - The key type.
      EventType - The type of the event.
      Parameters:
      priority - The priority of the event listener.
      eventClass - The event class to register the listener for.
      function - The function to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • registerUnhandled

      public <KeyType, EventType extends IBaseEvent<KeyType>> EventRegistration<KeyType, EventType> registerUnhandled(@Nonnull Class<? super EventType> eventClass, @Nonnull Consumer<EventType> consumer)
      Description copied from interface: IEventRegistry
      Called to register an unhandled event listener for the given event class, with the given consumer.
      Specified by:
      registerUnhandled in interface IEventRegistry
      Type Parameters:
      KeyType - The key type.
      EventType - The type of the event.
      Parameters:
      eventClass - The event class to register the listener for.
      consumer - The consumer to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • registerUnhandled

      public <KeyType, EventType extends IBaseEvent<KeyType>> EventRegistration<KeyType, EventType> registerUnhandled(@Nonnull EventPriority priority, @Nonnull Class<? super EventType> eventClass, @Nonnull Consumer<EventType> consumer)
      Description copied from interface: IEventRegistry
      Called to register an unhandled event listener for the given event class, with the given priority and consumer.
      Specified by:
      registerUnhandled in interface IEventRegistry
      Type Parameters:
      KeyType - The key type.
      EventType - The type of the event.
      Parameters:
      priority - The priority of the event listener.
      eventClass - The event class to register the listener for.
      consumer - The consumer to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • registerUnhandled

      public <KeyType, EventType extends IBaseEvent<KeyType>> EventRegistration<KeyType, EventType> registerUnhandled(short priority, @Nonnull Class<? super EventType> eventClass, @Nonnull Consumer<EventType> consumer)
      Description copied from interface: IEventRegistry
      Called to register an unhandled event listener for the given event class, with the given priority and consumer.
      Specified by:
      registerUnhandled in interface IEventRegistry
      Type Parameters:
      KeyType - The key type.
      EventType - The type of the event.
      Parameters:
      priority - The priority of the event listener.
      eventClass - The event class to register the listener for.
      consumer - The consumer to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • registerAsyncUnhandled

      public <KeyType, EventType extends IAsyncEvent<KeyType>> EventRegistration<KeyType, EventType> registerAsyncUnhandled(@Nonnull Class<? super EventType> eventClass, @Nonnull Function<CompletableFuture<EventType>, CompletableFuture<EventType>> function)
      Description copied from interface: IEventRegistry
      Called to register an async unhandled event listener for the given event class, with the given function.
      Specified by:
      registerAsyncUnhandled in interface IEventRegistry
      Type Parameters:
      KeyType - The key type.
      EventType - The type of the event.
      Parameters:
      eventClass - The event class to register the listener for.
      function - The function to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • registerAsyncUnhandled

      public <KeyType, EventType extends IAsyncEvent<KeyType>> EventRegistration<KeyType, EventType> registerAsyncUnhandled(@Nonnull EventPriority priority, @Nonnull Class<? super EventType> eventClass, @Nonnull Function<CompletableFuture<EventType>, CompletableFuture<EventType>> function)
      Description copied from interface: IEventRegistry
      Called to register an async unhandled event listener for the given event class, with the given priority and function.
      Specified by:
      registerAsyncUnhandled in interface IEventRegistry
      Type Parameters:
      KeyType - The key type.
      EventType - The type of the event.
      Parameters:
      priority - The priority of the event listener.
      eventClass - The event class to register the listener for.
      function - The function to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.
    • registerAsyncUnhandled

      public <KeyType, EventType extends IAsyncEvent<KeyType>> EventRegistration<KeyType, EventType> registerAsyncUnhandled(short priority, @Nonnull Class<? super EventType> eventClass, @Nonnull Function<CompletableFuture<EventType>, CompletableFuture<EventType>> function)
      Description copied from interface: IEventRegistry
      Called to register an async unhandled event listener for the given event class, with the given priority and function.
      Specified by:
      registerAsyncUnhandled in interface IEventRegistry
      Type Parameters:
      KeyType - The key type.
      EventType - The type of the event.
      Parameters:
      priority - The priority of the event listener.
      eventClass - The event class to register the listener for.
      function - The function to call when the event is dispatched.
      Returns:
      the event registration, or null if the registration failed.