Milanius Geschrieben 24. Juni 2021 Share Geschrieben 24. 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...
0 boomer41 Geschrieben 25. Juni 2021 Share Geschrieben 25. Juni 2021 Block blockY = world.getBlockAt(location2); ??? Soll das Teil jetzt raten, welche Position das sein soll? Da wurde nichts geschrieben. Die Variablen haben auch in der Klasse nichts verloren, die gehören in die Methode. Link zu diesem Kommentar Auf anderen Seiten teilen More sharing options...
Frage
Milanius
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!
Link zu diesem Kommentar
Auf anderen Seiten teilen
1 Antwort auf diese Frage
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