Got a question that the wiki doesn't answer? Ask on the forum (preferred), or join us on IRC.



From Wiki
Jump to: navigation, search

Scripts allow you to program small tasks without having to learn Java, figure out how to compile WorldEdit, or bother with reinventing the wheel. CraftScripts are written in JavaScript.

The scripting support that was available before v0.8 of WorldEdit is different.

Warning: You have to install the Rhino scripting library for this to work. See the the installation instructions for your platform.

Installing scripts

Create a plugins/WorldEdit/craftscripts/ directory in your server's root directory (.minecraft directory if single player) and place CraftScript files there. Script files should end with a .js extension.

Warning: Do not run scripts from untrusted sources.

Bundled scripts

Four scripts come with the WorldEdit download (be sure to copy the plugins/WorldEdit/craftscripts/ folder in the root directory from the download if you want them).

Filename Parameters Description
maze.js <block> [width] [length] Generates a maze with wall height of two made out of the specified block.
draw.js <image-file> [v] Renders an image file in-game with colored cloth blocks. Use the v parameter to draw it vertically. Image file must be placed into a plugins/WorldEdit/drawings/ directory.
quickshot.js <note1> [note2] ... Creates a basic set of note blocks linked together with Redstone. Example usage: quickshot.js 1a# 1c 2f
roof.js <block> Builds a pyramid roof over your selection.

Running scripts

  • /cs <script name> [args...]
  • /.s [args...] (re-executes last used script)
  • /<script>.js [args...] (shortcut)

This command runs the script. Don't forget the .js extension. Extra parameters can be given to the script file if it uses them.

Installing Rhino

In case your version of Java doesn't come with the necessary components (you get a "Failed to find an installed script engine."), you will have to install the Rhino JavaScript engine. If you get a "ReferenceError," then installing Rhino may fix your problem.

You should install Rhino if possible because the bundled version of Rhino that comes with Java is very slow

Writing scripts

Please see the development page.

Scripts are written in JavaScript.

Navigation menu