Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[New API] Check if a player joined for first time

Comments in 'Plugin Development' started by EvolSoft, Nov 25, 2014.

  1. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    I don't know if it's the right category for this thread.
    I want to port a my Bukkit plugin to PocketMine. In the Bukkit version I used
    Code:
    Player.hasPlayedBefore();
    
    And this code works perfectly on Bukkit. The problem is on PocketMine
    I tried this code
    PHP:
    $player->hasPlayedBefore();
    But it doesn't work. Exactly the function exists but it returns the same value. PocketMine bug?
    Last edited: Nov 25, 2014
    xFlare likes this.
  2. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    Nope, that function doesn't exists, you should use one of the following functions:
    PHP:
    $player->getFirstPlayed();
    or
    PHP:
    $player->getLastPlayed();
    Those functions do basically the same, but I highly recommend the first one.

    If the player already played before, the functions will return a Timestamp, the first function will contain the first time that the player entered the server, the second one will return the last time that the player joined the server. If the player haven't played before, those functions will return null.
    Last edited: Nov 25, 2014
  3. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    It was hasPlayedBefore(), I made a small mistake
    Last edited: Nov 25, 2014
  4. PixelGuy75
    Offline

    PixelGuy75 Notable Member Plugin Developer

    Joined:
    Feb 9, 2014
    Posts:
    316
    Plugins:
    2
    Minecraft User:
    PixelGuy75
    I was wondering the same thing.
    EvolSoft likes this.

Share This Page

Advertisement