Checking if it's a player's first login to the server...

Discussion in 'Plugin Development' started by VoidWhisperer, Aug 19, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    VoidWhisperer

    Is there any way, via the bukkit api or otherwise, to check if it's a player's first login into the server, not since the plugin was put in, but since the server was started. Any help would be appreciated.
     
  2. The OfflinePlayer class has a hasPlayedBefore() method which basically checks if the player has a .dat file.

    So you can use PlayerPreLoginEvent and use Bukkit.getOfflinePlayer(event.getName()) and then check if hasPlayedBefore()....

    Or if you want it when player already joined... you can use the same as above, if that doesn't work, you can use getFirstPlayed() and compare it against the current timestamp + a margin of error ( 30 seconds ? ).
     
    number1_Master likes this.
Thread Status:
Not open for further replies.

Share This Page