Craftscript installation instructions

This commit is contained in:
Jesse Boyd 2017-09-01 17:34:45 +10:00
parent b9d267a908
commit dcf46bbd3a
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -28,6 +28,7 @@ import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.scripting.RhinoCraftScriptEngine;
import java.io.File; import java.io.File;
@ -69,10 +70,13 @@ public class ScriptingCommands {
final File dir = this.worldEdit.getWorkingDirectoryFile(this.worldEdit.getConfiguration().scriptsDir); final File dir = this.worldEdit.getWorkingDirectoryFile(this.worldEdit.getConfiguration().scriptsDir);
final File f = this.worldEdit.getSafeOpenFile(player, dir, name, "js", "js"); final File f = this.worldEdit.getSafeOpenFile(player, dir, name, "js", "js");
try { try {
this.worldEdit.runScript(LocationMaskedPlayerWrapper.unwrap(player), f, scriptArgs); new RhinoCraftScriptEngine();
} catch (final WorldEditException ex) { } catch (NoClassDefFoundError e) {
player.printError("Error while executing CraftScript."); 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) @Command(aliases = {".s"}, usage = "[args...]", desc = "Execute last CraftScript", min = 0, max = -1)