我想在彼此之後運行2個循環,但它不會給我第二個日誌消息,因爲它在第一個循環中停止,所以它是p.sendMessage()
。我已經嘗試了一些不同的方法,但我需要列表。任何人都可以幫助我嗎?在彼此之後運行2個for循環
if(args[0].equalsIgnoreCase("start")){
if(game.players.containsKey(p.getUniqueId())){
String arenaname = game.players.get(p.getUniqueId());
ArrayList<UUID> listofplayer = new ArrayList<UUID>();
for (Entry<UUID, String> entry : game.players.entrySet()) {
if(entry.getValue().equalsIgnoreCase(arenaname)){
listofplayer.add(entry.getKey());
p.sendMessage("added");
}
}
for(int i=0; i==listofplayer.size()+1; i++){
UUID uuid = listofplayer.get(i);
p.sendMessage("added2");
for(Player player : Bukkit.getServer().getOnlinePlayers()){
if(player.getUniqueId().equals(uuid)){
p.sendMessage("added3");
World world = Bukkit.getWorld(main.arenas.getString("arenas." + arenaname + "." + i+1 + ".world"));
Location loc = new Location(world, main.arenas.getDouble("arenas." + arenaname + "." + i+1 + ".X")
, main.arenas.getDouble("arenas." + arenaname + "." + i+1 + ".Y")
, main.arenas.getDouble("arenas." + arenaname + "." + i+1 + ".Z"));
player.teleport(loc);
}
}
}
}
}
'i == listofplayer.size()+ 1;'這將從字面上什麼都不做。你的意思是讓==一個'<'符號? – Adam