Package org.bukkit.event

# 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 Summary

Constructors
Constructor
Description
`HandlerList()`
Create a new handler list and initialize using EventPriority.

## Method Summary

Modifier and Type
Method
Description
`void`
`bake()`
Bake HashMap and ArrayLists to 2d array - does nothing if not necessary
`static void`
`bakeAll()`
Bake all handler lists.
`static @NotNull ArrayList<HandlerList>`
`getHandlerLists()`
Get a list of all handler lists for every event type
`@NotNull RegisteredListener[]`
`getRegisteredListeners()`
Get the baked registered listeners associated with this handler list
`static @NotNull ArrayList<RegisteredListener>`
`getRegisteredListeners(@NotNull Plugin plugin)`
Get a specific plugin's registered listeners associated with this handler list
`void`
`register(@NotNull RegisteredListener listener)`
Register a new listener in this handler list
`void`
`registerAll(@NotNull Collection<RegisteredListener> listeners)`
Register a collection of new listeners in this handler list
`void`
`unregister(@NotNull Listener listener)`
Remove a specific listener from this handler
`void`
`unregister(@NotNull Plugin plugin)`
Remove a specific plugin's listeners from this handler
`void`
`unregister(@NotNull RegisteredListener listener)`
Remove a listener from a specific order slot
`static void`
`unregisterAll()`
Unregister all listeners from all handler lists.
`static void`
`unregisterAll(@NotNull Listener listener)`
Unregister a specific listener from all handler lists.
`static void`
`unregisterAll(@NotNull Plugin plugin)`
Unregister a specific plugin's listeners from all handler lists.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## 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 @NotNull Plugin plugin)
Unregister a specific plugin's listeners from all handler lists.

Parameters:
  `plugin` - plugin to unregister

### unregisterAll

public static void unregisterAll(@NotNull @NotNull Listener listener)
Unregister a specific listener from all handler lists.

Parameters:
  `listener` - listener to unregister

### register

public void register(@NotNull @NotNull RegisteredListener listener)
Register a new listener in this handler list

Parameters:
  `listener` - listener to register

### registerAll

public void registerAll(@NotNull @NotNull Collection<RegisteredListener> listeners)
Register a collection of new listeners in this handler list

Parameters:
  `listeners` - listeners to register

### unregister

public void unregister(@NotNull @NotNull RegisteredListener listener)
Remove a listener from a specific order slot

Parameters:
  `listener` - listener to remove

### unregister

public void unregister(@NotNull @NotNull Plugin plugin)
Remove a specific plugin's listeners from this handler

Parameters:
  `plugin` - plugin to remove

### unregister

public void unregister(@NotNull @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 @NotNull RegisteredListener[] getRegisteredListeners()
Get the baked registered listeners associated with this handler list

Returns:
  the array of registered listeners

### getRegisteredListeners

@NotNull public static @NotNull ArrayList<RegisteredListener> getRegisteredListeners(@NotNull @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 @NotNull ArrayList<HandlerList> getHandlerLists()
Get a list of all handler lists for every event type

Returns:
  the list of all handler lists