Solved Output list of multiple players

Discussion in 'Development' started by ethaniccc, Mar 10, 2020.

  1. ethaniccc

    ethaniccc Baby Zombie

    Messages:
    136
    GitHub:
    ethaniccc
    Is there a way I can output a list of multiple players?
    Kind of like the /list command, it will output all the players you can see, with a list.
     
  2. TobiasDev

    TobiasDev Spider

    Messages:
    13
    GitHub:
    tobiasg-de
    Yea you can get the list of all online players by using Server#getOnlinePlayers() and Iterate over them or implode them to an string of players delimeted by any string.
     
    ethaniccc likes this.
  3. Mr174

    Mr174 Baby Zombie

    Messages:
    186
    GitHub:
    mr174
    PHP:
    $players = [];
            foreach (
    $server->getOnlinePlayers() as $player){
                
    $players[] = $player->getName();
            }
     
    ethaniccc likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.