Player: First time join a world

Discussion in 'Plugin Development' started by paxi, Aug 21, 2014.

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

    paxi

    Hello everybody,

    is there an existing method to look if the player was in the world which he is entering (PlayerChangeWorldEvent) before?
    Like the first log in on a Server!

    Thanks
    paxi :)
     
  2. Offline

    JWhy

    You could check whether the player's .dat file exists in the world folder.
     
  3. Offline

    AlphaRLee

    Is this what you are looking for?

    Code:java
    1. @EventHandler
    2. public void onPlayerJoin(PlayerJoinEvent event) {
    3.  
    4. [INDENT=1]Player player = event.getPlayer();[/INDENT]
    5.  
    6. [INDENT=1]if (player.hasPlayedBefore() == false {[/INDENT]
    7. [INDENT=2]//Do whatever you want when entering the world[/INDENT]
    8. [INDENT=2]player.sendMessage("This is your first time on this server!");[/INDENT]
    9. [INDENT=1]}[/INDENT]
    10. }
    11.  
    12. }
     
Thread Status:
Not open for further replies.

Share This Page