Хостинг серверов Minecraft playvds.com
  1. Вы находитесь в русском сообществе Bukkit. Мы - администраторы серверов Minecraft, разрабатываем собственные плагины и переводим на русский язык плагины наших собратьев из других стран.
    Dismiss Notice

Помогите Как через определённые промежутка времени на случайных кордах спавнить сундук?

Discussion in 'Разработка плагинов для новичков' started by AguR, May 10, 2020.

  1. Автор темы
    AguR

    AguR Активный участник Пользователь

    Trophy Points:
    61
    Имя в Minecraft:
    AguRChek_TV
    Как через определённые промежутка времени на случайных кордах спавнить сундук?
    Я пытался сделать так но оно не работает.



    Code:
            Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
                @Override
                public void run() {
                    if(todroptime == 0) {
                        todroptime = 121;
                    }
                    todroptime--;
                }
            }, 0, 20);
            if(todroptime == 61) {
                int random = (int) (Math.random() * 4) + 1;
                if(random == 1) {
                    Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
                        @Override
                        public void run() {
                            int randomx1 = (int) (Math.random() * 2500) + 1;
                            int randomz1 = (int) (Math.random() * 2500) + 1;
                            rx = randomx1;
                            ry = Bukkit.getWorld("world2").getHighestBlockYAt(randomx1, randomz1);
                            rz = randomz1;
                            if(Bukkit.getWorld("world2").getBlockAt(rx, ry, rz).getType() != Material.WATER) {
                                return;
                            }
                        }
                    }, 0, 20);
                }
                if(random == 2) {
                    Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
                        @Override
                        public void run() {
                            int randomx2 = (int) (Math.random() * 2500) + 1;
                            int randomz2 = (int) (Math.random() * 2500) + 1;
                            rx = randomx2;
                            ry = Bukkit.getWorld("world2").getHighestBlockYAt(randomx2, randomz2);
                            rz = randomz2;
                            if(Bukkit.getWorld("world2").getBlockAt(rx, ry, rz).getType() != Material.WATER) {
                                return;
                            }
                        }
                    }, 0, 20);
                }
                if(random == 3) {
                    Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
                        @Override
                        public void run() {
                            int randomx3 = (int) (Math.random() * 2500) + 1;
                            int randomz3 = (int) (Math.random() * 2500) + 1;
                            rx = randomx3;
                            ry = Bukkit.getWorld("world2").getHighestBlockYAt(randomx3, randomz3);
                            rz = randomz3;
                            if(Bukkit.getWorld("world2").getBlockAt(rx, ry, rz).getType() != Material.WATER) {
                                return;
                            }
                        }
                    }, 0, 20);
                }
                if(random == 4) {
                    Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
                        @Override
                        public void run() {
                            int randomx4 = (int) (Math.random() * 2500) + 1;
                            int randomz4 = (int) (Math.random() * 2500) + 1;
                            rx = randomx4;
                            ry = Bukkit.getWorld("world2").getHighestBlockYAt(randomx4, randomz4);
                            rz = randomz4;
                            if(Bukkit.getWorld("world2").getBlockAt(rx, ry, rz).getType() != Material.WATER) {
                                return;
                            }
                        }
                    }, 0, 20);
                }
                for(Player ps : Bukkit.getOnlinePlayers()) {
                    ps.sendMessage(ChatColor.DARK_RED + "" + ChatColor.BOLD + "in 10 minutes will fall air drop with loot at the coordinates " + rx + " " + rz);
                    ps.sendTitle(ChatColor.DARK_RED + "" + ChatColor.BOLD + "in 10 minutes will fall air drop with loot at the coordinates " + rx + " " + rz, "");
                }
            }
            if(todroptime == 0) {
                todroptime = 121;
                Location l = (new Location(Bukkit.getWorld("world"), rx, ry, rz));
                l.getBlock().setType(Material.CHEST);
            }
     
  2. Хостинг MineCraft
    <

Share This Page