Clearing a region with worldedit API

Discussion in 'Spigot Plugin Development' started by MrSpyMan, May 17, 2015.

  1. I am trying to save the region in a .schematic file, then clear it. I don't have much but I have this so far..
    Code (Text):

    ProtectedRegion region = WGBukkit.getRegionManager(Bukkit.getWorld(worldname)).getRegion(plot_id);
    CuboidSelection cs = new CuboidSelection(Bukkit.getWorld(worldname), region.getMaximumPoint(), region.getMaximumPoint());
    I know I will need to loop through every block in the region and do something like block.setType(Material.AIR). If there's a better way please tell me. That's not really the issue. I know how to do that. But I don't know how to save the region into a .schematic file. If I do, arg1) it will take a CuboidClipboard which is Deprecated and a File for arg1. Since CuboidClipboard is Deprecated what do I use to save a schematic?​
  2. Deprecated methods don't always mean they don't work anymore. They just aren't suggested to use most of the time. Try using the deprecated CuboidClipboard with the save method and see how it end up.
  3. You can always loop through blocks with simple for loops too, check if the block is within a bound (the region bound) and if so set material as 0.