Class EventRegistry<E extends Event>

java.lang.Object
org.skriptlang.skript.util.event.EventRegistry<E>
Type Parameters:
E - The class representing the type of events this register will hold.

public class EventRegistry<E extends Event> extends Object
An EventRegistry is a generic container for events. They are to be used for providing standardized Event functionality wherever deemed useful.
  • Constructor Details

    • EventRegistry

      public EventRegistry()
  • Method Details

    • register

      public void register(E event)
      Registers the provided event with this register.
      Parameters:
      event - The event to register.
    • register

      public <T extends E> void register(Class<T> eventType, T event)
      Registers the provided event with.
      Parameters:
      eventType - The type of event being registered. This is useful for registering an event that is a FunctionalInterface using a lambda.
      event - The event to register.
    • unregister

      public void unregister(E event)
      Unregisters the provided event.
      Parameters:
      event - The event to unregister.
    • events

      public @Unmodifiable Set<E> events()
      Returns:
      An unmodifiable set of this register's events.
    • events

      public <T extends E> @Unmodifiable Set<T> events(Class<T> type)
      Parameters:
      type - The type of events to get.
      Returns:
      An unmodifiable subset (of the specified type) of this register's events