I want to do “random teleports”.
Writed this code:
} else if (plain.equalsIgnoreCase("rtp")) {
World world = Sponge.getServer().getWorld(Sponge.getServer().getDefaultWorldName()).get();
int x = NevendaarUtils.RANDOM.nextInt(20000) - 10000;
int z = NevendaarUtils.RANDOM.nextInt(20000) - 10000;
int y = world.getHighestYAt(x, z);
Sponge.getServer().getBroadcastChannel().send(Text.of("highest = " + y));
event.getCause().first(Player.class).get().setLocation(new Location<World>(world, x, y, z));
Sponge.getServer().getBroadcastChannel().send(Text.of("Successfully!"));
}
But Y is always 0…
What Im doing wrong?