mirror of
https://github.com/Minestom/Minestom.git
synced 2024-06-28 07:24:57 +02:00
b26abc11b0
Signed-off-by: TheMode <themode@outlook.fr>
25 lines
568 B
Java
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();
|
|
}
|