As say typic, I need to know how to check if Player is online.
Try to get the player from the server and check if the returned Optional is present:
if (Sponge.getServer().getPlayer(playername).isPresent()){
//do stuff...
}
1 Like
But when I have method: if(!Sponge.getServer().getPlayer(username).isPresent()){} and it returns false even if player is online
Well the !
in your expression is negating itβ¦ so it will be false if the player is online but true if he is offline ^^β
idk what happened, but it started working. Thx!