Minestom/src/test/java/net/minestom/server/api/FlexibleListener.java
TheMode b26abc11b0 Fix shared instance unregistering
Signed-off-by: TheMode <themode@outlook.fr>
2022-02-07 23:39:57 +01:00

25 lines
568 B
Java

package net.minestom.server.api;
import net.minestom.server.event.Event;
import org.jetbrains.annotations.NotNull;
import java.util.function.Consumer;
public interface FlexibleListener<E extends Event> {
/**
* Updates the handler. Fails if the previous followup has not been called.
*/
void followup(@NotNull Consumer<E> handler);
default void followup() {
followup(event -> {
// Empty
});
}
/**
* Fails if an event is received. Valid until the next followup call.
*/
void failFollowup();
}