From aa5a182788eea3e556f77097643d37458a2f8e86 Mon Sep 17 00:00:00 2001 From: TheMode Date: Wed, 2 Jun 2021 19:52:05 +0200 Subject: [PATCH] Add EventNode#removeChild --- src/main/java/net/minestom/server/event/EventNode.java | 2 ++ src/main/java/net/minestom/server/event/EventNodeImpl.java | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/main/java/net/minestom/server/event/EventNode.java b/src/main/java/net/minestom/server/event/EventNode.java index 615879052..21ce0f70e 100644 --- a/src/main/java/net/minestom/server/event/EventNode.java +++ b/src/main/java/net/minestom/server/event/EventNode.java @@ -33,6 +33,8 @@ public interface EventNode { void addChild(@NotNull EventNode child); + void removeChild(@NotNull EventNode child); + void addListener(@NotNull EventListener listener); void removeListener(@NotNull EventListener listener); diff --git a/src/main/java/net/minestom/server/event/EventNodeImpl.java b/src/main/java/net/minestom/server/event/EventNodeImpl.java index 0c9b5dc16..cc23dd219 100644 --- a/src/main/java/net/minestom/server/event/EventNodeImpl.java +++ b/src/main/java/net/minestom/server/event/EventNodeImpl.java @@ -52,6 +52,11 @@ class EventNodeImpl implements EventNode { this.children.add((EventNode) child); } + @Override + public void removeChild(@NotNull EventNode child) { + this.children.remove(child); + } + @Override public void addListener(@NotNull EventListener listener) { this.listenerMap.computeIfAbsent(listener.type, aClass -> new CopyOnWriteArrayList<>())