forked from SteamWar/SteamWar
Refactor schematic checks to handle unseen notifications
This commit is contained in:
@@ -85,12 +85,15 @@ public interface Chatter {
|
||||
else
|
||||
return withPlayer.apply(player);
|
||||
}
|
||||
default void withPlayerOrOffline(Consumer<Player> withPlayer, Runnable withOffline) {
|
||||
default boolean withPlayerOrOffline(Consumer<Player> withPlayer, Runnable withOffline) {
|
||||
Player player = getPlayer();
|
||||
if(player == null)
|
||||
if(player == null) {
|
||||
withOffline.run();
|
||||
else
|
||||
return false;
|
||||
} else {
|
||||
withPlayer.accept(player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
default void withPlayer(Consumer<Player> function) {
|
||||
withPlayerOrOffline(function, () -> {});
|
||||
|
||||
Reference in New Issue
Block a user