Teleport all online players to a given location.

Discussion in 'Plugin Development' started by Phinary, Jul 11, 2012.

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

    Phinary

    I am trying to use something where I teleport all online players to a certain location. I am assuming I would need to use some sort of for loop for this, and I wan't it so that I can check each player if they have a certain permission, and if they do, tp them and if they don't, don't tp them. The biggest issue I am having is trying to get a list of all players online, then create a loop that will tp each of them to a location. Can someone please help me with this or direct me to some things I can use to do this? Thanks
     
  2. Offline

    ProFatal

    Code:
    for(Player p : Bukkit.getOnlinePlayers()){
        p.teleport(new Location(plugin.getServer().getWorld("World"), 0.0, 0.0, 0.0));
    }
    This gets the players online and then teleports them to
    x - 0
    y - 0
    z - 0
     
  3. Offline

    Phinary

    Yeah, I figured this out literally like 30 seconds before you posted this. Thanks for the help though :p
     
  4. Offline

    ProFatal

    No problem :)
     
Thread Status:
Not open for further replies.

Share This Page