Solved Get a random online player

Discussion in 'Plugin Development' started by superchris05326, Oct 18, 2014.

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

    superchris05326

    I want to get a random online. Everywhere I look it tells me the same outdated code. Everything about random player selection is based upon Bukkit.getServer().getOnlinePlayers() returning an array which it's now a collection. Does anyone know how I would go about doing this?
     
  2. Offline

    Mrcool234

    Random rand = new Random();

    rand.nextInt(Bukkit.getOnlinePlayers().length);
     
  3. Offline

    Funergy

    Mrcool234 superchris05326 and if you have the random then do Bukkit.getOnlinePlayers[rand.nextInt(Bukkit.getOnlinePlayers().length)]
     
  4. Offline

    Funergy

  5. Offline

    superchris05326

    AdamQpzm Thank you, I have solved the problem on accident by using craftbukkit in the java build path.
     
  6. superchris05326 I'm not sure what you've done, but it sounds like a bad idea.
     
    Skyost likes this.
Thread Status:
Not open for further replies.

Share This Page