From dcf46bbd3aa1ee9df053ea0ef85888bc2e4472b8 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Fri, 1 Sep 2017 17:34:45 +1000 Subject: [PATCH] Craftscript installation instructions --- .../com/sk89q/worldedit/command/ScriptingCommands.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java b/core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java index 6183bfbd..28529fa7 100644 --- a/core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java +++ b/core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java @@ -28,6 +28,7 @@ import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.scripting.RhinoCraftScriptEngine; import java.io.File; @@ -69,10 +70,13 @@ public class ScriptingCommands { final File dir = this.worldEdit.getWorkingDirectoryFile(this.worldEdit.getConfiguration().scriptsDir); final File f = this.worldEdit.getSafeOpenFile(player, dir, name, "js", "js"); try { - this.worldEdit.runScript(LocationMaskedPlayerWrapper.unwrap(player), f, scriptArgs); - } catch (final WorldEditException ex) { - player.printError("Error while executing CraftScript."); + new RhinoCraftScriptEngine(); + } catch (NoClassDefFoundError e) { + player.printError("Failed to find an installed script engine."); + player.printError("Please "); + return; } + this.worldEdit.runScript(LocationMaskedPlayerWrapper.unwrap(player), f, scriptArgs); } @Command(aliases = {".s"}, usage = "[args...]", desc = "Execute last CraftScript", min = 0, max = -1)