Solved Cannot get blocks to spawn.

Discussion in 'Plugin Development' started by Aypro, Jan 18, 2021.

Thread Status:
Not open for further replies.
  1. Offline

    Aypro

    I was making a plugin in Java, Bukkit, but, I can not seem to make this work:
    Code:
        public void test() {
            Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
                @Override
                public void run() {
                    try {
                        if (!started && playersJoined >= 1 && startingIn > 0 && startedTimer) {
                            System.out.println(startingIn);
    
                            startingIn--;
                        } else if (!started && playersJoined >= 1 && startingIn == 0 && startedTimer) {
                            System.out.println("EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE");
                            started = true;
                            Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
                                @Override
                                public void run() {
                                    int y = 1;
                                    for (int x = 1; x > 369; x++) {
                                        for (int z = 1; z > 369; z++) {
                                            Location location = new Location(gettWorld(), x, y, z);// me spammed willy now gib reward
                                            location.getBlock().setType(Material.REDSTONE_BLOCK);
                                        }
                                    }
                                }
                            }, 0, 200L);
                        }
                    } catch (Exception ex) {
                        System.out.println("The error is" + ex);//
                    }
                }
            }, 0, 20);
        }
    . What I want to do is spawn those blocks on the coordinates.
     
  2. Online

    timtower Administrator Administrator Moderator

    @Aypro And what is happening?
     
  3. Offline

    Aypro

    So I have a timer in the code in another thread and when the timer reaches 0, this code is supposed to spawn Red stone block in the x,y and z cordinates but it's not spawning the blocks when the timer reaches 0
     
  4. Online

    timtower Administrator Administrator Moderator

    @Aypro Is the method getting called?
     
  5. Offline

    Aypro

    Yeah.
     
  6. Online

    timtower Administrator Administrator Moderator

    Add
    location.getBlock().update()
    and a message.
     
    Aypro likes this.
Thread Status:
Not open for further replies.

Share This Page