- Баллы
- 66
- Имя в Minecraft
- steklopaKet32_46
Мне для мини игры нужен специальный рандом телепорт . Сторонние плагины не хочу юзать)
Меня тпхает за world boarder как это исправить?
код
int gx = (int) p.getWorld().getWorldBorder().getCenter().getX();
int gz = (int) p.getWorld().getWorldBorder().getCenter().getZ();
int gg = (int) p.getWorld().getWorldBorder().getSize();
p.sendMessage("dfdf "+gg);
int x =gg/2 + gx;
int z=gg/2 + gz;
Random rnd = new Random();
int xr = rnd.nextInt(x+1);
int zr = rnd.nextInt(z+1);
int y = 0;
for(;y<200;y++) {
Location l = new Location(p.getWorld(), xr, y, zr);
if(l.getBlock().getType() == Material.AIR) {
break;
}
}
Location loc = new Location(p.getWorld(), xr, y, zr);
p.teleport(loc);
Меня тпхает за world boarder как это исправить?
код
int gx = (int) p.getWorld().getWorldBorder().getCenter().getX();
int gz = (int) p.getWorld().getWorldBorder().getCenter().getZ();
int gg = (int) p.getWorld().getWorldBorder().getSize();
p.sendMessage("dfdf "+gg);
int x =gg/2 + gx;
int z=gg/2 + gz;
Random rnd = new Random();
int xr = rnd.nextInt(x+1);
int zr = rnd.nextInt(z+1);
int y = 0;
for(;y<200;y++) {
Location l = new Location(p.getWorld(), xr, y, zr);
if(l.getBlock().getType() == Material.AIR) {
break;
}
}
Location loc = new Location(p.getWorld(), xr, y, zr);
p.teleport(loc);