Package net.minestom.server.event
Class GlobalEventHandler
java.lang.Object
net.minestom.server.event.GlobalEventHandler
Object containing all the global event listeners.
-
Constructor Summary
Constructors -
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 StringgetName()int<E extends T,H>
@NotNull EventNode<E> map(H value, @NotNull EventFilter<E, H> filter) Maps a specific object to a node.voidregister(@NotNull EventBinding<? extends Event> binding) removeChild(@NotNull EventNode<? extends Event> child) Directly removes the given child from this node.voidremoveChildren(@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()voidPrevents the node fromEventNode.map(Object, EventFilter)to be called.voidunregister(@NotNull EventBinding<? extends Event> binding) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:EventNodeGets 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:EventNodeLocates all child nodes with the given name and event type recursively starting at this node.- Specified by:
findChildrenin 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:EventNodeReturns an unmodifiable view of the children in this node.- Specified by:
getChildrenin 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:EventNodeReplaces 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:
replaceChildrenin 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:EventNodeRecursively removes children with the given name and type starting at this node.- Specified by:
removeChildrenin 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:EventNodeDirectly adds a child node to this node. -
removeChild
@NotNull public @NotNull EventNode<Event> removeChild(@NotNull @NotNull EventNode<? extends Event> child) Description copied from interface:EventNodeDirectly removes the given child from this node.- Specified by:
removeChildin 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:
addListenerin interfaceEventNode<T extends Event>
-
removeListener
@NotNull public @NotNull EventNode<Event> removeListener(@NotNull @NotNull EventListener<? extends Event> listener) - Specified by:
removeListenerin 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:EventNodeMaps 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:EventNodePrevents the node fromEventNode.map(Object, EventFilter)to be called. -
register
-
unregister
- Specified by:
unregisterin interfaceEventNode<T extends Event>
-
getEventType
- Specified by:
getEventTypein interfaceEventNode<T extends Event>
-
getName
-
getPriority
public int getPriority()- Specified by:
getPriorityin interfaceEventNode<T extends Event>
-
setPriority
- Specified by:
setPriorityin interfaceEventNode<T extends Event>
-
getParent
-
toString
-