package net.minestom.server.event; import net.minestom.server.event.handler.EventHandler; import org.jetbrains.annotations.NotNull; import java.util.List; import java.util.function.BiPredicate; import java.util.function.Predicate; public interface EventNode { static EventNode type(@NotNull EventFilter filter) { return new EventNodeImpl<>(filter); } static EventNode all() { return type(EventFilter.ALL); } static EventNodeConditional conditional(@NotNull EventFilter filter, @NotNull BiPredicate predicate) { return new EventNodeConditional<>(filter, predicate); } static EventNodeConditional conditionalEvent(@NotNull EventFilter filter, @NotNull Predicate predicate) { return conditional(filter, (e, h) -> predicate.test(e)); } static EventNodeConditional conditionalHandler(@NotNull EventFilter filter, @NotNull Predicate predicate) { return conditional(filter, (e, h) -> predicate.test(h)); } static EventNodeList list(@NotNull EventFilter filter) { return new EventNodeList<>(filter); } void call(@NotNull T event); void addChild(@NotNull EventNode child); void removeChild(@NotNull EventNode child); void addListener(@NotNull EventListener listener); void removeListener(@NotNull EventListener listener); @NotNull String getName(); @NotNull List<@NotNull EventNode> getChildren(); }