How to paste a schematic with FAWE

Discussion in 'Spigot Plugin Development' started by SirZiegenKease, Nov 6, 2019.

  1. Hey,

    i wanna make an function which paste an schematic from FAWE but i didnt find how to? I looked at some post about how to do it with worldedit but this doesn't work anymore with FAWE. So, how can i do it? The FAWE Wiki page about "Pasting a Schematic" isn't really helpful
     
  2. Why? You literally just need to copy and paste, you don’t even need to know how to code.
     
  3. He could be making a Skyblock plugin which needs to auto generate an island with a schematic.
     
    • Like Like x 1
  4. I’m referring to the fact that you can copy and paste the code snippet on the FAWE wiki
     
  5. You cant^^ You need a special vector named BlockVector3d and the class is protected. I talked with one of the devs of FAWE and he explained me how to use it

    Code (Java):
    EditSession editSession = ClipboardFormats.findByFile(f).load(f).paste(new BukkitWorld(loc.getWorld()), BlockVector3.at(loc.getX(), loc.getY(), loc.getZ()));
     
  6. I don't know if this is using FAWE or just WE, but I have used this in the past with good results.

    Code (Text):
        public boolean pasteSchematic(String schematicName, Location loc, boolean noAir) {
            World weWorld = new BukkitWorld(loc.getWorld());
         
            File file = new File(getDataFolder() + File.separator + "schematics" + File.separator + schematicName + ".schematic");
            if (file.exists() == false) {
                return false;
            }
            boolean allowUndo = false;
            Vector vec = new Vector(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
            try {
                EditSession editSession = ClipboardFormats.findByFile(file)
                        .load(file)
                        .paste(weWorld, vec, allowUndo, !noAir, (Transform) null);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return false;
            }
            return true;
        }
     
    • Useful Useful x 1
  7. Pretty sure this is almost exactly what the FAWE wiki shows.
     
    • Agree Agree x 1