mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-08 17:37:42 +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;
|
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,
|
public static <E extends Event> EventNode<E> conditional(@NotNull Class<E> type,
|
||||||
@NotNull Predicate<E> predicate) {
|
@NotNull Predicate<E> predicate) {
|
||||||
return new EventNodeConditional<>(type, 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) {
|
protected boolean condition(@NotNull T event) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ public class PlayerInit {
|
|||||||
|
|
||||||
// EVENT REGISTERING
|
// EVENT REGISTERING
|
||||||
|
|
||||||
var node = EventNode.conditional(PlayerEvent.class);
|
var node = EventNode.create(PlayerEvent.class);
|
||||||
node.addListener(EventListener.of(PlayerTickEvent.class)
|
node.addListener(EventListener.of(PlayerTickEvent.class)
|
||||||
.handler(playerTickEvent -> System.out.println("Player tick!"))
|
.handler(playerTickEvent -> System.out.println("Player tick!"))
|
||||||
.build());
|
.build());
|
||||||
|
Loading…
Reference in New Issue
Block a user