if at least 1 player online

Discussion in 'Spigot Plugin Development' started by Syanko, Jun 22, 2018.

  1. i want execute command at least 1 player online how i check server online player
  2. Benz56

    Moderator Supporter

    Code (Java):
    if (Bukkit.getOnlinePlayers() > 0) {
      //Do stuff
  3. thx
  4. i tried but it says
    Description Resource Path Location Type
    The operator > is undefined for the argument type(s) Collection<capture#1-of ? extends Player>, int Syankobuild.java /Syankobuilduhc/src/me/syanko/builduhc line 15 Java Problem
  5. foncused

    Moderator Patron

    Bukkit.getOnlinePlayers().size() should do the trick.
    • Agree Agree x 1
  6. Benz56

    Moderator Supporter

    What he said ^

    My bad. On my phone ;)