Solved Getting all online players Location

Discussion in 'Plugin Development' started by DominicGamesHD, Jul 23, 2017.

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

    DominicGamesHD

    Okay so I am just wondering what code I would use to collect all online players locations and spawn a block behind them, i have the spawning the block sorted, I am trying to get all their locations and make it spawn behind them

    Thanks in advance
    ---
    DominicGames
     
  2. Offline

    Machine Maker

    @DominicGamesHD Iterate over the Collection Bukkit.getOnlinePlayers(); and get their location.

    Code:
    for (Player p : Bukkit.getOnlinePlayers()) {
        p.getLocation().getYaw();
    }
    check the yaw to see what direction they are facing. I'll give you a hint. 0 is due west and 90 is due north. Then you can subtract/add one to the X/Z coordinate and place the block.
     
  3. Offline

    DominicGamesHD

    Thanks!
     
  4. Offline

    Machine Maker

    @DominicGamesHD
    Please mark this thread as solved if your issue is resolved.
     
Thread Status:
Not open for further replies.

Share This Page