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

How to get last player in world?

Comments in 'Plugin Development' started by PalkiaDudeYT, Oct 6, 2015.

  1. PalkiaDudeYT
    Offline

    PalkiaDudeYT New Member

    Joined:
    Aug 30, 2015
    Posts:
    33
    Minecraft User:
    PalkiaDude
    DeadEnd might be finished as soon as this is anwered...
  2. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    What do tou mean by last Player?
  3. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    He means to get the last player that was in the world
    BTW : impossible for me.
    TheKofola12 likes this.
  4. PalkiaDudeYT
    Offline

    PalkiaDudeYT New Member

    Joined:
    Aug 30, 2015
    Posts:
    33
    Minecraft User:
    PalkiaDude
    I did it! Used the player amount target found in the world limit plugins code
  5. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    So you didn't do it. Copy & Paste doesn't help.
  6. PianoPlayer38
    Offline

    PianoPlayer38 New Member

    Joined:
    Sep 29, 2015
    Posts:
    3
    Minecraft User:
    Ment97
    I gave you last like you needed to get Notable!
    Taha_The_Hacker likes this.
  7. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    PHP:
    if(count($level->getPlayers()) === 1){
        foreach(
    $level->getPlayers() as $p){ //maybe better would be array_shift() by idk if it work
            
    $last $p;
        }
    }
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    array_shift() is better. Not sure if it makes things faster, but at least it is more clean and readable.
    Creeperface likes this.

Share This Page

Advertisement