[solved] Worldedit schematic problems...

Discussion in 'Plugin Development' started by chriztopia, Sep 19, 2012.

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

    chriztopia

    I am trying to save and load schematics in to the same place they come from. instead of pasting it back it will move it around few blocks over or down. every spot ends up differently off so I cant just cheat and add what its off to the plugin.

    Code:
    //BETA COMMAND   
        if (cmd.getName().equalsIgnoreCase("beta")){
    World world = player.getWorld();
     
    //World world1 = player.getWorld();
    RegionManager regionManager = this.getWorldGuard().getRegionManager(world);
     
    ProtectedRegion set2 = regionManager.getRegionExact(args[0]);
     
    int x = set2.getMinimumPoint().getBlockX();
    int y = set2.getMinimumPoint().getBlockY();
    int z = set2.getMinimumPoint().getBlockZ();
    Vector v1 = new Vector(x,y,z);
    //Location loc = new Location(world, x,y,z);
    File file = new File(getDataFolder() + File.separator + args[0] + ".schematic");
     
    try {
        loadArea(world,file, v1);
    } catch (MaxChangedBlocksException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (DataException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    player.sendMessage("Done" + x + " Y: " + y + " Z: " + z + " Done");
        }
    Code:
    @SuppressWarnings("deprecation")
    private void loadArea(World world, File file,Vector origin) throws DataException, IOException, MaxChangedBlocksException{
            EditSession es = new EditSession(new BukkitWorld(world), 500000);
        CuboidClipboard cc = CuboidClipboard.loadSchematic(file);
      // cc.paste(es, origin, false);
        cc.place(es, origin, false);
    }
     
Thread Status:
Not open for further replies.

Share This Page