#857 Create event for failed authentication
This commit is contained in:
@@ -25,6 +25,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* Service for operations requiring the Bukkit API, such as for scheduling.
|
||||
@@ -263,6 +264,20 @@ public class BukkitService implements SettingsDependent {
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an event with the provided function and emits it.
|
||||
*
|
||||
* @param eventSupplier the event supplier: function taking a boolean specifying whether AuthMe is configured
|
||||
* in async mode or not
|
||||
* @param <E> the event type
|
||||
* @return the event that was created and emitted
|
||||
*/
|
||||
public <E extends Event> E createAndCallEvent(Function<Boolean, E> eventSupplier) {
|
||||
E event = eventSupplier.apply(useAsyncTasks);
|
||||
callEvent(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the world with the given name.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user