Selection to schematic

Discussion in 'Programming Help' started by NurPech, Jun 21, 2017.

  1. NurPech

    NurPech New Member

    Hi,

    I've created a plugin which will create a worldedit selection and then a worldguard region. In the worldguard region a specific player is set as owner.
    So the selection will be auto generated by the plugin.
    Let me show you how the selection and the region is generated:
    ------------------------------------------------------------------------------------------------
    World w= getWorld();
    Location pos1 = getPos1();
    Location pos2 = getPos2();
    Selection sel = new CuboidSelection(w, pos1, pos2);
    BlockVector min = sel.getNativeMinimumPoint().toBlockVector();
    BlockVector max = sel.getNativeMaximumPoint().toBlockVector();
    String worldName = sel.getWorld().getName().toLowerCase();
    String regionName = ""
    Region region = (Region) new CuboidRegion(min, max);
    region.expand(
    new Vector(0, (w.getMaxHeight() + 1), 0),
    new Vector(0, -(w.getMaxHeight() + 1), 0));
    ProtectedCuboidRegion rg = new ProtectedCuboidRegion(regionName, region.getMinimumPoint().toBlockVector(), region.getMaximumPoint().toBlockVector());

    RegionManager manager = WGBukkit.getRegionManager(p.getWorld());
    --------------------------------------------------------------------------------------------------------

    I want to save the selection (the region) to a schematic so that at later time the terrain could be resetted (changes from the player will be discarded if the region will be deleted).

    Kind regards,
    NurPech
  2. wizjany

    wizjany Administrator Developer

    you said the region already exists right? just grab it from the manager in the first place. i don't know what pos1 or pos2 has to do with anything. the region's bounds are defined by the region already.

    as for saving the schematic, there's a whole bunch of threads and examples already you should probably look at, like this http://forum.enginehub.org/threads/how-to-paste-schematic-with-v6-1.16194/