feat(api): Implement AuthmeVelocityAPI#isNotLogged

This commit is contained in:
4drian3d 2022-07-12 16:06:13 +00:00
parent 6365866e59
commit 64f4fd5176

View File

@ -19,6 +19,7 @@ public final class AuthmeVelocityAPI {
this.plugin = plugin; this.plugin = plugin;
this.config = config; this.config = config;
} }
/** /**
* Check if the player is logged in or not * Check if the player is logged in or not
* @param player the player * @param player the player
@ -28,6 +29,15 @@ public final class AuthmeVelocityAPI {
return plugin.loggedPlayers.contains(player.getUniqueId()); return plugin.loggedPlayers.contains(player.getUniqueId());
} }
/**
* Check if the player is not logged
* @param player the player
* @return if the player is not logged
*/
public boolean isNotLogged(@NotNull Player player){
return !plugin.loggedPlayers.contains(player.getUniqueId());
}
/** /**
* Adds a player to the list of logged in players * Adds a player to the list of logged in players
* @param player the new logged player * @param player the new logged player
@ -51,7 +61,7 @@ public final class AuthmeVelocityAPI {
* @param predicate the condition * @param predicate the condition
*/ */
public void removePlayerIf(@NotNull Predicate<Player> predicate){ public void removePlayerIf(@NotNull Predicate<Player> predicate){
plugin.loggedPlayers.removeIf(uuid -> predicate.test(plugin.getProxy().getPlayer(uuid).orElseThrow())); plugin.loggedPlayers.removeIf(uuid -> predicate.test(plugin.getProxy().getPlayer(uuid).orElse(null)));
} }
/** /**