diff --git a/src/main/java/net/minestom/server/event/EventNode.java b/src/main/java/net/minestom/server/event/EventNode.java index dd57afdcb..990483a89 100644 --- a/src/main/java/net/minestom/server/event/EventNode.java +++ b/src/main/java/net/minestom/server/event/EventNode.java @@ -528,11 +528,12 @@ public class EventNode { public void map(@NotNull EventNode node, @NotNull Object value) { final var nodeType = node.eventType; + final var valueType = value.getClass(); final boolean correct = getEventFilters(nodeType).stream().anyMatch(eventFilter -> { final var handlerType = eventFilter.handlerType(); - return handlerType != null && handlerType.isAssignableFrom(value.getClass()); + return handlerType != null && handlerType.isAssignableFrom(valueType); }); - Check.stateCondition(!correct, "The node {0} is not compatible with objects of type {1}", nodeType, value.getClass()); + Check.stateCondition(!correct, "The node filter {0} is not compatible with type {1}", nodeType, valueType); //noinspection unchecked this.mappedNode.put(value, (EventNode) node); }