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 a server's Current/Max players?

Comments in 'Plugin Development' started by Hittmana, May 7, 2016.

  1. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    How can I get the current number of players on my server as well as the maximum number of players?
  2. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    PHP:
    $current_number count($this->getServer()->getOnlinePlayers()); //Current # of players
    $max_number $this->getServer()->getMaxPlayers(); //Max # of players
    udwarf and Primus like this.
  3. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    Thanks!

Share This Page

Advertisement