This commit is contained in:
TheMode 2021-08-14 21:28:51 +02:00
parent e5f0dc8061
commit 93405cd180

View File

@ -528,11 +528,12 @@ public class EventNode<T extends Event> {
public void map(@NotNull EventNode<? extends T> 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<T>) node);
}