From bdfa164695ab99337eeb09aafa0f43fe416dc83d Mon Sep 17 00:00:00 2001 From: TheMode Date: Wed, 2 Jun 2021 11:29:16 +0200 Subject: [PATCH] Do not reuse node objects --- src/main/java/net/minestom/server/event/EventNode.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/minestom/server/event/EventNode.java b/src/main/java/net/minestom/server/event/EventNode.java index 30ffb35d9..dbba4c1b1 100644 --- a/src/main/java/net/minestom/server/event/EventNode.java +++ b/src/main/java/net/minestom/server/event/EventNode.java @@ -23,16 +23,14 @@ public class EventNode { this.type = type; } - private static final EventNode EMPTY = new EventNode<>(Event.class); - - public static EventNode create() { - return EMPTY; - } - public static EventNode create(@NotNull Class type) { return new EventNode<>(type); } + public static EventNode create() { + return create(Event.class); + } + public static EventNode conditional(@NotNull Class type, @NotNull Predicate predicate) { return new EventNodeConditional<>(type, predicate);