jb-aero / SKCompat

An extension to CommandHelper providing access to features of other plugins in the sk89q family.
GNU Lesser General Public License v3.0
3 stars 5 forks source link

NoSuchMethodError with skcb_paste() when using FastAsyncWorldEdit #30

Open Murreey opened 7 years ago

Murreey commented 7 years ago

Since updating to 1.12 I'm getting this error when trying to use skcb_paste():

[10:43:55 WARN]: [CommandHelper] Task #169 for CommandHelper v3.3.2-SNAPSHOT.3218- generated an exception
java.lang.NoSuchMethodError: com.sk89q.worldedit.command.ClipboardCommands.paste(Lcom/sk89q/worldedit/entity/Player;Lcom/sk89q/worldedit/LocalSession;Lcom/sk89q/worldedit/EditSession;ZZZ)V
        at io.github.jbaero.skcompat.CHWorldEdit$skcb_paste.exec(CHWorldEdit.java:639) ~[?:?]
        at com.laytonsmith.core.Script.eval(Script.java:375) ~[?:?]
        at com.laytonsmith.core.Script.eval(Script.java:344) ~[?:?]
        at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:2001) ~[?:?]
        at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1958) ~[?:?]
        at com.laytonsmith.commandhelper.CommandHelperInterpreterListener.execute(CommandHelperInterpreterListener.java:155) ~[?:?]
        at com.laytonsmith.commandhelper.CommandHelperInterpreterListener.textLine(CommandHelperInterpreterListener.java:127) ~[?:?]
        at com.laytonsmith.commandhelper.CommandHelperInterpreterListener$1.run(CommandHelperInterpreterListener.java:66) ~[?:?]
        at com.laytonsmith.abstraction.bukkit.BukkitConvertor$1.call(BukkitConvertor.java:271) ~[?:?]
        at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftFuture.run(CraftFuture.java:89) ~[spigot.jar:git-Spigot-7228328-af1c013]
        at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:353) [spigot.jar:git-Spigot-7228328-af1c013]
        at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:738) [spigot.jar:git-Spigot-7228328-af1c013]
        at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:405) [spigot.jar:git-Spigot-7228328-af1c013]
        at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:678) [spigot.jar:git-Spigot-7228328-af1c013]
        at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:576) [spigot.jar:git-Spigot-7228328-af1c013]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_131]

Doesn't happen with only WorldEdit, but does with FAWE. I'm running latest builds of everything.

(Might also be relevant to @boy0001)

boy0001 commented 7 years ago

idk why it's using the command method directly to do the paste. It'll break if any of the arguments are changed. In this case I added some flags to control whether entities or biomes are pasted e.g. //paste -e

Using the proper API, or the command dispatcher would be better, since it wouldn't break if any commands are tweaked.

I've temporarily fixed this by adding the previous method without the new flags.

jb-aero commented 7 years ago

Hi, I will have to go relearn everything. Off the top of my head I'm guessing I wanted to use something built into the command, but you are right, that does sound like a misuse.

boy0001 commented 7 years ago

Also, skcp_set won't work with normal WorldEdit as the command was changed (ages ago). It should work with the latest FAWE which has the method.

Example of using the dispatcher:

String cmd = "/paste";
if (airless) cmd += " -a";
if (origin) cmd += " -o";
if (select) cmd += " -s";

CommandLocals locals = new CommandLocals();
locals.put(Actor.class, user);
locals.put("arguments", cmd);

WorldEdit.getInstance().getPlatformManager().getCommandManager().getDispatcher().call(cmd, locals, new String[0]);

Example of using the API: