- Баллы
- 76
- Имя в Minecraft
- AguRChek_TV
у меня есть 7 координат
и мне нужно каждого игрока который в gamemode adventure тепнуть на рандомные координаты
как это можно сделать?
я пробовал так
я не до конца понял как работать с этими листами.
помогите пожалуйста
Код:
Location loc1 = new Location(Bukkit.getWorld("world"), 11.5, 5.5, -3.5, 60, 0);
Location loc2 = new Location(Bukkit.getWorld("world"), -9.5, 6.5, -9.5, -50, 0);
Location loc3 = new Location(Bukkit.getWorld("world"), -3.5, 7.5, 11.5, -160, 0);
Location loc4 = new Location(Bukkit.getWorld("world"), -18.5, 7.5, -27.5, -20, 0);
Location loc5 = new Location(Bukkit.getWorld("world"), 29.5, 6.5, -19.5, 60, 0);
Location loc6 = new Location(Bukkit.getWorld("world"), 21.5, 7.5, 27.5, 140, 0);
Location loc7 = new Location(Bukkit.getWorld("world"), -19.5, 7.5, 26.5, -150, 0);
и мне нужно каждого игрока который в gamemode adventure тепнуть на рандомные координаты
как это можно сделать?
я пробовал так
Код:
int index = 0;
ArrayList<Player> PE2 = new ArrayList<Player>();
for(Player PI : Bukkit.getOnlinePlayers()) {
if(PI.getGameMode().equals(GameMode.ADVENTURE)) {
PE2.add(PI);
}
}
ArrayList<Location> loc = new ArrayList<Location>();
loc.add(loc1);
loc.add(loc2);
loc.add(loc3);
ArrayList<Integer> int1 = new ArrayList<Integer>();
while(int1.size() <= loc.size()) {
int size2 = loc.size()-1;
int int21 = (int) Math.random() * size2;
if(!int1.contains(int21)) {
int1.add(int21);
}
}
for(Player p21 : PE2) {
index++;
p21.teleport(loc.get(int1.get(index)));
}
я не до конца понял как работать с этими листами.
помогите пожалуйста