1.8.8 setBlock

Discussion in 'Spigot Plugin Development' started by xDabDoub, Jun 30, 2020.

  1. Hi, is there's a method for setting a certain block to air or any other block?
    For example:
    There's a block located at X:1 Y:1 Z:1

    Is there's a method that i can change that block to air?
     
  2. block#setType
     
  3. setType(Material.AIR)
     
  4. Thanks, i've read the library, i am new to java, is there's a way that i can Specify what block i want to set to air by location of it?
     
  5. ex4

    ex4

    Use World#getBlockAt(Location)
     
  6. Example:
    @EventHandler
    public void BlockPlace(BlockPlaceEvent e) {
    e.getBlock().setType(Material.AIR);
    }
     
  7. World#getBlockAt(x, y, z).setType(Material.AIR);