Solved [1.12.2] Cannot find FAWE "World" type, only bukkit World

Discussion in 'Spigot Plugin Development' started by Ammonium_, Feb 4, 2020.

  1. I'm trying to use the FAWE API to paste a schematic, but it says it requires "", while I only have org.Bukkit.World:
    Now, I know I should just need to import FAWE's world type, but if I try to import it says that it cannot resolve symbol "World":
    I found that there IS a type called "BukkitWorld" within com.sk89.worldedit, but it still doesn't accept it:
    Here's my relevant maven dependencies and repositories:
    I already verified they got added correctly, since other things such as EditSession are recognized correctly.
    I am using Spigot 1.12.2

    Can you please help me?
    #1 Ammonium_, Feb 4, 2020
    Last edited: Feb 4, 2020
  2. Also, this is inside a PlayerInteractEvent, so whichever World I need to cast it to, I hope it can be casted from player.getWorld(). Would this work?
  3. This looks like something you might need
  4. This is probably what your looking for:
    Code (Java):
         * Create a WorldEdit world from a Bukkit world.
         * @param world the Bukkit world
         * @return a WorldEdit world

        public static World adapt(org.bukkit.World world) {
            return new BukkitWorld(world);
  5. Where can I access that function from though? Because world.adapt() doesn't work. I also already have worldedit-bukkit version 7.1.0 installed. My guess is that it could be due to a version mismatch between worldedit-bukkit 7.1.0 and fawe-api LATEST, but I'm not sure what versions to put in their place.
  6. Hey, it worked! At least sorta. It matches the world type, but now it can't resolve method load():
    I'm getting closer to it. I see there's a .getWriter() method now. Maybe I use .getWriter() and then another similar to .load() ?
    #8 Ammonium_, Feb 4, 2020
    Last edited: Feb 4, 2020
  7. Apparently for 1.12.2 you need to use this piece of code instead

    Code (Java):
    WorldData worldData = world.getWorldData();
    Clipboard clipboard = ClipboardFormat.SCHEMATIC.getReader(new FileInputStream(file)).read(worldData);
    // Region region = clipboard.getRegion();

    EditSession extent = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1);
    AffineTransform transform = new AffineTransform();

    ForwardExtentCopy copy = new ForwardExtentCopy(clipboard, clipboard.getRegion(), clipboard.getOrigin(), extent, position);
    if (!transform.isIdentity()) copy.setTransform(transform);
    copy.setSourceMask(new ExistingBlockMask(clipboard));
    I'll mark this as solved for now
  8. since youre using fawe, fawe has an api for schematic loading.