mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-06 16:37:38 +01:00
Fix conditional factory not actually having a condition
This commit is contained in:
parent
5d1b742934
commit
12c620df7a
@ -29,15 +29,15 @@ public class EventNode<T extends Event> {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
public static <E extends Event> EventNode<E> create(@NotNull Class<E> type) {
|
||||
return new EventNode<>(type);
|
||||
}
|
||||
|
||||
public static <E extends Event> EventNode<E> conditional(@NotNull Class<E> type,
|
||||
@NotNull Predicate<E> predicate) {
|
||||
return new EventNodeConditional<>(type, predicate);
|
||||
}
|
||||
|
||||
public static <E extends Event> EventNode<E> conditional(@NotNull Class<E> eventType) {
|
||||
return conditional(eventType, t -> true);
|
||||
}
|
||||
|
||||
protected boolean condition(@NotNull T event) {
|
||||
return true;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class PlayerInit {
|
||||
|
||||
// EVENT REGISTERING
|
||||
|
||||
var node = EventNode.conditional(PlayerEvent.class);
|
||||
var node = EventNode.create(PlayerEvent.class);
|
||||
node.addListener(EventListener.of(PlayerTickEvent.class)
|
||||
.handler(playerTickEvent -> System.out.println("Player tick!"))
|
||||
.build());
|
||||
|
Loading…
Reference in New Issue
Block a user