Milanius Posted June 22, 2021 Share Posted June 22, 2021 Ich möchte ein Random Spawn Plugin programmieren (ich benutze Eclipse) aber es funktioniert nicht. Was funktioniert nicht? Könntet ihr mir Helfen Danke im Vorraus! public class onJoin implements Listener { Location locationRaw; Location locationRaw2; Location location; Location location2; @EventHandler private void onPlayerJoin(PlayerJoinEvent e) { for(Player p : Bukkit.getOnlinePlayers()) { World world = Bukkit.getWorlds().get(0); int X = getRandom(1500, -1500); int Y = getRandom(250, 1); Block blockY = world.getBlockAt(location2); if(blockY.getType() == Material.GRASS_BLOCK) { int rawY = world.getHighestBlockYAt(locationRaw2); int Z = getRandom(1500, -1500); locationRaw2 = new Location(world, X, Y, Z); locationRaw = new Location(world, X, rawY, Z); location = new Location(world, X, rawY -2, Z); location2 = new Location(world, X, rawY -1, Z); Block block1 = world.getBlockAt(locationRaw); block1.setType(Material.AIR); Block block2 = world.getBlockAt(locationRaw); block2.setType(Material.AIR); Block block3 = world.getBlockAt(location2); block3.setType(Material.AIR); p.setBedSpawnLocation(location); p.teleport(location); } } } public int getRandom(int lower, int upper) { Random random = new Random(); return random.nextInt((upper - lower) + 1) + lower; } } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now