Solved How to load a .schematic?

Discussion in 'Plugin Development' started by 1SmallVille1, May 6, 2013.

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

    1SmallVille1

    So I'm working on a plugin that will allow a player to place a certain block and then load a schematic. I can do all the events correctly, I was just wondering how to load a schematic. Hooking with WorldEdit would be a fine way to do it. So far this is the code I have but .loadSchematic is deprecated:
    Code:Java
    1. private void loadArea(World world, File file,Vector origin) throws DataException, IOException, MaxChangedBlocksException{
    2. EditSession es = new EditSession(new BukkitWorld(world), 999999999);
    3. CuboidClipboard cc = CuboidClipboard.loadSchematic(file);
    4. cc.paste(es, origin, false);
    5. }
     
  2. Offline

    Ewe Loon

    here is my last load and paste

    Code:
        public void loadcube(String n,World w,int x,int y,int z){
            try {
                File fl=new File("schematics"+sep+"Arenas"+sep+n+".schematic");
                SchematicFormat sf=SchematicFormat.getFormat(fl);
                CuboidClipboard cc=sf.load(fl);            
                LocalWorld lw=BukkitUtil.getLocalWorld(w);
                EditSession es=new EditSession(lw, 1000000);
                Vector v=new Vector(x, y, z);
                cc.paste(es, v, false);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    just so you know, sep is file.seperator
     
    1SmallVille1 likes this.
  3. Offline

    1SmallVille1

    ah, this is perfect thank you
     
Thread Status:
Not open for further replies.

Share This Page