Milanius Geschrieben 22. Juni 2021 Share Geschrieben 22. Juni 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 zu diesem Kommentar Auf anderen Seiten teilen More sharing options...
Empfohlene Beiträge
Erstelle ein Benutzerkonto oder melde dich an, um zu kommentieren
Du musst ein Benutzerkonto haben, um einen Kommentar verfassen zu können
Benutzerkonto erstellen
Neues Benutzerkonto für unsere Community erstellen. Es ist einfach!
Neues Benutzerkonto erstellenAnmelden
Du hast bereits ein Benutzerkonto? Melde dich hier an.
Jetzt anmelden