Solved Changing all blocks in a Cuboid

Discussion in 'Plugin Development' started by chriztopia, Dec 31, 2012.

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

    chriztopia

    I want to chang all blocks from one loc to a second loc to Dirt Blocks. I pulled this from minereset. It runs with no errors but does not change the blocks.

    Code:
                        Location one = this.stringToLoc(this.getsignConfig().getString("default.floor.pos1"));
                    Location two = this.stringToLoc(this.getsignConfig().getString("default.floor.pos2"));
                World world = one.getWorld();
                   
                    for (int x = one.getBlockX(); x <= two.getBlockX(); x++) {
                        for (int y = one.getBlockY(); y <= two.getBlockY(); y++) {
                            for (int z = one.getBlockZ(); z <= two.getBlockZ(); z++) {
                                Block block = world.getBlockAt(x, y, z);
        block.setType(Material.DIRT);
     
                            }
                        }
                    }
     
  2. Offline

    fireblast709

    chriztopia you sure position two > position one
     
  3. Offline

    chriztopia


    That was it. I will do a check to make sure that the locations are correctly done. Any Suggestion on blocking all commands in a certian area? :)
     
  4. Offline

    fireblast709

    PlayerCommandPreprocessEvent. Just check if the Location of the player is inside the cuboid
     
Thread Status:
Not open for further replies.

Share This Page