What is the correct usage of for (Player p : )
if I am trying to get the player's location and teleport them within a Bukkit scheduled task? It gives me an unidentified error when using a :
which I believe I need to connect the reset of the statement together, but there may be another way. Although this is a Minecraft Bukkit-related question, I'm sure someone here is able to help me out.
Current code:
private void teleporter()
{
if (getConfig().getBoolean("teleport")) {
Bukkit.getScheduler().scheduleSyncRepeatingTask(this,
new Runnable()
{
public void run() {
for (Player p : ) {
if (p.getLocation().getY() <= 0.0D)
{
p.teleport(NoVoid.spawnLocation);
p.setFallDistance(0.0F);
}
}
}
}, 0L, 100L);
}
}
Any help is appreciated!
Update:
Rusher and rgettman had the right idea. Had to add Bukkit.getServer().getOnlinePlayers()
to get all of the online players (had to connect it to a list).