1.17.x How to do this with FAWE?

Discussion in 'Spigot Plugin Development' started by DevBukkit, Jun 24, 2021.

  1. Hey,

    So what I'm trying to do is I want to load up a schematic from a file and then paste it at a location and loop the pasted region finding certain blocks. What's the best and most optimized way of doing this using fastasyncworldedit? I can't work out how to it at all and I've been trying for a while now
  2. I believe you just need to use WorldEdit API and paste it like you'd usually do with WE and have FAWE installed in the server.
  3. I've tried this, but sadly it just tries looking for the FAWE world and not the WE World. There's so little docs on how to do these things. :/
  4. I currently have the following method, but I have no luck of getting to work

    Code (Java):
        public void paste(File file, org.bukkit.Location target) {
            World world = BukkitAdapter.adapt(target.getWorld());
            Location location = BukkitAdapter.adapt(target);
            EditSession session = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1);
            Clipboard schematic = getSchematic(file);

            ClipboardFormat format = ClipboardFormats.findByFile(file);
            try (ClipboardReader reader = format.getReader(new FileInputStream(file))) {

                Operation operation = new ClipboardHolder(schematic)
            } catch (IOException e) {
    The schematic part within the new ClipboardHolder highlights red with the error of

    Code (Text):
    'ClipboardHolder(com.sk89q.worldedit.extent.clipboard.Clipboard, com.sk89q.worldedit.world.registry.WorldData)' in 'com.sk89q.worldedit.session.ClipboardHolder' cannot be applied to '(com.sk89q.worldedit.extent.clipboard.Clipboard)'
    If anyone knows how to fix this, I'll be extremely thankful there's a lack of resources or documentation when it comes to WorldEdit one of the most used plugins out there, what's fairly surprising to me.