Minecraft plugin, find all players in a world?

Ma
- in Worlds
4

I would like to work on a Minecraft Pvp plugin soon. However, it shouldn't be for bungee cord, but for spigot. So that means: I can't determine when the game starts via the players who are online. So you have to use a separate world for e.g. The lobby. Then I plan to count the players in the world and as soon as the players are above a certain value (e.g. 8) the game should start. Now the problem is that I don't know how to get the players told in a world. Can anyone help me?

ba

Bukkit.getOnlinePlayers ()

Gives you all the players who are online on the server. Then you can query the world of each and then proceed.

Ma

So you could do it like this:

all = Bukkit.getonlineplayers ()

if (all.getWorld == diegesuchtewelt) {

p.sendMessage ("This is where the process happens")

}

Can it work like that?

ba

Something like that, yes. But you'd have to do a for loop around the players.

Ma

So:

for (int i = 0; i <8) {

if (all.getWorld () == world) {

i ++;

}

}

Can it work like that? Or do I have a board right now?