Class GlobalEventHandler

java.lang.Object
net.minestom.server.event.GlobalEventHandler
All Implemented Interfaces:
EventNode<Event>

public final class GlobalEventHandler extends Object
Object containing all the global event listeners.
  • 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.
      Specified by:
      getHandle in interface EventNode<T extends Event>
      Type Parameters:
      E - the event type
      Parameters:
      handleType - the handle type
      Returns:
      the handle linked to handleType
    • 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 interface EventNode<T extends Event>
      Parameters:
      name - The event node name to filter for
      eventType - The event node type to filter for
      Returns:
      All matching event nodes
    • getChildren

      @Contract(pure=true) @NotNull public @NotNull Set<@NotNull EventNode<Event>> getChildren()
      Description copied from interface: EventNode
      Returns an unmodifiable view of the children in this node.
      Specified by:
      getChildren in interface EventNode<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 interface EventNode<T extends Event>
      Parameters:
      name - The event name to filter for
      eventType - The event node type to filter for
      eventNode - 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 interface EventNode<T extends Event>
      Parameters:
      name - The node name to filter for
      eventType - 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.
      Specified by:
      addChild in interface EventNode<T extends Event>
      Parameters:
      child - The child to add
      Returns:
      this, can be used for chaining
    • 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 interface EventNode<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 interface EventNode<T extends Event>
    • removeListener

      @NotNull public @NotNull EventNode<Event> removeListener(@NotNull @NotNull EventListener<? extends Event> listener)
      Specified by:
      removeListener in interface EventNode<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.

      Specified by:
      map in interface EventNode<T extends Event>
      Parameters:
      value - the mapped value
      filter - the filter to use
      Returns:
      the node (which may have already been registered) directly linked to value
    • unmap

      public void unmap(@NotNull @NotNull Object value)
      Description copied from interface: EventNode
      Prevents the node from EventNode.map(Object, EventFilter) to be called.
      Specified by:
      unmap in interface EventNode<T extends Event>
      Parameters:
      value - the value to unmap
    • register

      public void register(@NotNull @NotNull EventBinding<? extends Event> binding)
      Specified by:
      register in interface EventNode<T extends Event>
    • unregister

      public void unregister(@NotNull @NotNull EventBinding<? extends Event> binding)
      Specified by:
      unregister in interface EventNode<T extends Event>
    • getEventType

      @NotNull public @NotNull Class<Event> getEventType()
      Specified by:
      getEventType in interface EventNode<T extends Event>
    • getName

      @NotNull public @NotNull String getName()
      Specified by:
      getName in interface EventNode<T extends Event>
    • getPriority

      public int getPriority()
      Specified by:
      getPriority in interface EventNode<T extends Event>
    • setPriority

      @NotNull public @NotNull EventNode<Event> setPriority(int priority)
      Specified by:
      setPriority in interface EventNode<T extends Event>
    • getParent

      @Nullable public @Nullable EventNode<? super Event> getParent()
      Specified by:
      getParent in interface EventNode<T extends Event>
    • toString

      public String toString()
      Overrides:
      toString in class Object