Package org.bukkit.event
Class HandlerList
java.lang.Object
org.bukkit.event.HandlerList
A list of event handlers, stored per-event. Based on lahwran's fevents.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
bake()
Bake HashMap and ArrayLists to 2d array - does nothing if not necessarystatic void
bakeAll()
Bake all handler lists.static @NotNull ArrayList
<HandlerList> Get a list of all handler lists for every event typeGet the baked registered listeners associated with this handler liststatic @NotNull ArrayList
<RegisteredListener> getRegisteredListeners
(@NotNull Plugin plugin) Get a specific plugin's registered listeners associated with this handler listvoid
register
(@NotNull RegisteredListener listener) Register a new listener in this handler listvoid
registerAll
(@NotNull Collection<RegisteredListener> listeners) Register a collection of new listeners in this handler listvoid
unregister
(@NotNull Listener listener) Remove a specific listener from this handlervoid
unregister
(@NotNull Plugin plugin) Remove a specific plugin's listeners from this handlervoid
unregister
(@NotNull RegisteredListener listener) Remove a listener from a specific order slotstatic void
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.
-
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
Unregister a specific plugin's listeners from all handler lists.- Parameters:
plugin
- plugin to unregister
-
unregisterAll
Unregister a specific listener from all handler lists.- Parameters:
listener
- listener to unregister
-
register
Register a new listener in this handler list- Parameters:
listener
- listener to register
-
registerAll
Register a collection of new listeners in this handler list- Parameters:
listeners
- listeners to register
-
unregister
Remove a listener from a specific order slot- Parameters:
listener
- listener to remove
-
unregister
Remove a specific plugin's listeners from this handler- Parameters:
plugin
- plugin to remove
-
unregister
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
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
Get a list of all handler lists for every event type- Returns:
- the list of all handler lists
-