I'm trying to use the FAWE API to paste a schematic, but it says it requires "com.sk89q.worldedit.world.World", 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?
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?
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) { checkNotNull(world); return new BukkitWorld(world); }
that version of fawe isnt up to date with the newest worldedit. use worldedit 6 https://dev.bukkit.org/projects/worldedit/files
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.
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() ?
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)); Operations.completeLegacy(copy); extent.flushQueue(); I'll mark this as solved for now