Refactor schematic checks to handle unseen notifications

This commit is contained in:
2025-03-24 16:50:39 +01:00
parent 0da3ebfbcc
commit 71522973a7
4 changed files with 62 additions and 21 deletions
@@ -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, () -> {});