Class HandlerList

java.lang.Object
org.bukkit.event.HandlerList

public class HandlerList
extends Object
A list of event handlers, stored per-event. Based on lahwran's fevents.
  • Constructor Details

    • HandlerList

      public HandlerList()
      Create a new handler list and initialize using EventPriority.

      The HandlerList is then added to meta-list for use in bakeAll()

  • Method Details

    • bakeAll

      public static void bakeAll()
      Bake all handler lists. Best used just after all normal event registration is complete, ie just after all plugins are loaded if you're using fevents in a plugin system.
    • unregisterAll

      public static void unregisterAll()
      Unregister all listeners from all handler lists.
    • unregisterAll

      public static void unregisterAll​(@NotNull Plugin plugin)
      Unregister a specific plugin's listeners from all handler lists.
      Parameters:
      plugin - plugin to unregister
    • unregisterAll

      public static void unregisterAll​(@NotNull Listener listener)
      Unregister a specific listener from all handler lists.
      Parameters:
      listener - listener to unregister
    • register

      public void register​(@NotNull RegisteredListener listener)
      Register a new listener in this handler list
      Parameters:
      listener - listener to register
    • registerAll

      public void registerAll​(@NotNull Collection<RegisteredListener> listeners)
      Register a collection of new listeners in this handler list
      Parameters:
      listeners - listeners to register
    • unregister

      public void unregister​(@NotNull RegisteredListener listener)
      Remove a listener from a specific order slot
      Parameters:
      listener - listener to remove
    • unregister

      public void unregister​(@NotNull Plugin plugin)
      Remove a specific plugin's listeners from this handler
      Parameters:
      plugin - plugin to remove
    • unregister

      public void unregister​(@NotNull Listener listener)
      Remove a specific listener from this handler
      Parameters:
      listener - listener to remove
    • bake

      public void bake()
      Bake HashMap and ArrayLists to 2d array - does nothing if not necessary
    • getRegisteredListeners

      @NotNull public RegisteredListener[] getRegisteredListeners()
      Get the baked registered listeners associated with this handler list
      Returns:
      the array of registered listeners
    • getRegisteredListeners

      @NotNull public static ArrayList<RegisteredListener> getRegisteredListeners​(@NotNull Plugin plugin)
      Get a specific plugin's registered listeners associated with this handler list
      Parameters:
      plugin - the plugin to get the listeners of
      Returns:
      the list of registered listeners
    • getHandlerLists

      @NotNull public static ArrayList<HandlerList> getHandlerLists()
      Get a list of all handler lists for every event type
      Returns:
      the list of all handler lists