net.minestom.server.event.EventBinding Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of minestom-snapshots Show documentation
Show all versions of minestom-snapshots Show documentation
1.20.4 Lightweight Minecraft server
package net.minestom.server.event;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Predicate;
@ApiStatus.Experimental
public interface EventBinding {
static @NotNull FilteredBuilder filtered(@NotNull EventFilter filter, @NotNull Predicate predicate) {
return new FilteredBuilder<>(filter, predicate);
}
@NotNull Collection> eventTypes();
@NotNull Consumer<@NotNull E> consumer(@NotNull Class extends Event> eventType);
class FilteredBuilder {
private final EventFilter filter;
private final Predicate predicate;
private final Map, BiConsumer