Coopah ArrayList<String> team1 = new ArrayList<String>(); ArrayList<String> team2 = new ArrayList<String>(); Integer i -= 0; for(Player p : Bukkit.getOnlinePlayers()){ if(i == 0){ team1.add(p.getUUID().toString); i == 1; }else{ team2.add(p.getUUID().toString); i == 0; } } *Wrote it here, havent tested, should work
Coopah but you should be able to fix them. One would consider using int instead of Integer. Assignment should be done with single =. toString is a method.
Why can't you just store the players? (it's more accessible + you don't have to take up the time to do a username lookup (or UUID lookup (is that even a thing?)) As shown here: Code:java ArrayList<Player> team1 = new ArrayList<Player>();ArrayList<Player> team2 = new ArrayList<Player>();int i = 0; for (Player p : Bukkit.getOnlinePlayers()){if (i % 2 == 0){team1.add(p);i++;} else {team2.add(p);i--;}}
Rocoty Integer is tha best :3, Coopah and yea, as I said, wrote it here ... also the .getUniqueId()..