Package net.minestom.server.event
Class GlobalEventHandler
java.lang.Object
net.minestom.server.event.GlobalEventHandler
Object containing all the global event listeners.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDirectly adds a child node to this node.addListener
(@NotNull EventListener<? extends Event> listener) findChildren
(@NotNull String name, Class<E> eventType) Locates all child nodes with the given name and event type recursively starting at this node.Returns an unmodifiable view of the children in this node.<E extends T>
@NotNull ListenerHandle<E> Gets the handle of an event type.@NotNull String
getName()
int
<E extends T,
H>
@NotNull EventNode<E> map
(H value, @NotNull EventFilter<E, H> filter) Maps a specific object to a node.void
register
(@NotNull EventBinding<? extends Event> binding) removeChild
(@NotNull EventNode<? extends Event> child) Directly removes the given child from this node.void
removeChildren
(@NotNull String name, @NotNull Class<? extends Event> eventType) Recursively removes children with the given name and type starting at this node.removeListener
(@NotNull EventListener<? extends Event> listener) <E extends T>
voidreplaceChildren
(@NotNull String name, @NotNull Class<E> eventType, @NotNull EventNode<E> eventNode) Replaces all children matching the given name and type recursively starting from this node.setPriority
(int priority) toString()
void
Prevents the node fromEventNode.map(Object, EventFilter)
to be called.void
unregister
(@NotNull EventBinding<? extends Event> binding) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minestom.server.event.EventNode
addListener, call, callCancellable, findChildren, hasListener, removeChildren, replaceChildren
-
Constructor Details
-
GlobalEventHandler
public GlobalEventHandler()
-
-
Method Details
-
getHandle
@NotNull public <E extends T> @NotNull ListenerHandle<E> getHandle(@NotNull @NotNull Class<E> handleType) Description copied from interface:EventNode
Gets the handle of an event type. -
findChildren
@NotNull public <E extends T> @NotNull List<EventNode<E>> findChildren(@NotNull @NotNull String name, Class<E> eventType) Description copied from interface:EventNode
Locates all child nodes with the given name and event type recursively starting at this node.- Specified by:
findChildren
in interfaceEventNode<T extends Event>
- Parameters:
name
- The event node name to filter foreventType
- The event node type to filter for- Returns:
- All matching event nodes
-
getChildren
Description copied from interface:EventNode
Returns an unmodifiable view of the children in this node.- Specified by:
getChildren
in interfaceEventNode<T extends Event>
- See Also:
-
replaceChildren
public <E extends T> void replaceChildren(@NotNull @NotNull String name, @NotNull @NotNull Class<E> eventType, @NotNull @NotNull EventNode<E> eventNode) Description copied from interface:EventNode
Replaces all children matching the given name and type recursively starting from this node.Node: The callee may not be replaced by this call.
- Specified by:
replaceChildren
in interfaceEventNode<T extends Event>
- Parameters:
name
- The event name to filter foreventType
- The event node type to filter foreventNode
- The replacement node
-
removeChildren
public void removeChildren(@NotNull @NotNull String name, @NotNull @NotNull Class<? extends Event> eventType) Description copied from interface:EventNode
Recursively removes children with the given name and type starting at this node.- Specified by:
removeChildren
in interfaceEventNode<T extends Event>
- Parameters:
name
- The node name to filter foreventType
- The node type to filter for
-
addChild
@NotNull public @NotNull EventNode<Event> addChild(@NotNull @NotNull EventNode<? extends Event> child) Description copied from interface:EventNode
Directly adds a child node to this node. -
removeChild
@NotNull public @NotNull EventNode<Event> removeChild(@NotNull @NotNull EventNode<? extends Event> child) Description copied from interface:EventNode
Directly removes the given child from this node.- Specified by:
removeChild
in interfaceEventNode<T extends Event>
- Parameters:
child
- The child to remove- Returns:
- this, can be used for chaining
-
addListener
@NotNull public @NotNull EventNode<Event> addListener(@NotNull @NotNull EventListener<? extends Event> listener) - Specified by:
addListener
in interfaceEventNode<T extends Event>
-
removeListener
@NotNull public @NotNull EventNode<Event> removeListener(@NotNull @NotNull EventListener<? extends Event> listener) - Specified by:
removeListener
in interfaceEventNode<T extends Event>
-
map
@NotNull public <E extends T,H> @NotNull EventNode<E> map(@NotNull H value, @NotNull @NotNull EventFilter<E, H> filter) Description copied from interface:EventNode
Maps a specific object to a node.Be aware that such structure have huge performance penalty as they will always require a map lookup. Use only at last resort.
-
unmap
Description copied from interface:EventNode
Prevents the node fromEventNode.map(Object, EventFilter)
to be called. -
register
-
unregister
- Specified by:
unregister
in interfaceEventNode<T extends Event>
-
getEventType
- Specified by:
getEventType
in interfaceEventNode<T extends Event>
-
getName
-
getPriority
public int getPriority()- Specified by:
getPriority
in interfaceEventNode<T extends Event>
-
setPriority
- Specified by:
setPriority
in interfaceEventNode<T extends Event>
-
getParent
-
toString
-