Check if a server is empty

Discussion in 'Plugin Development' started by gamelord327, Aug 5, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    gamelord327

    For my plugin i need the plugin to check if there are no other players online. Thank you
     
  2. Offline

    Seadragon91

    Code:
    if (Bukkit.getServer().getOnlinePlayers().length == 0) { //... }
    Take a look into the javadocs.
     
  3. Offline

    Tarestudio

    gamelord327
    You could listen to PlayerQuitEvent and perhaps need to listen to PlayerKickEvent as well, dont know if kick triggers quit. On Event check Bukkit.getOnlinePlayers().lenght
    Second way is a scheduler checking in intervall the onlineplayers.
     
  4. Offline

    Henzz

    I think you can try using:
    Bukkit.getServer().getOnlinePlayers().length
    and check if it's equal to 0
     
Thread Status:
Not open for further replies.

Share This Page