diff --git a/README.md b/README.md index 0290848..14009cf 100644 --- a/README.md +++ b/README.md @@ -65,8 +65,8 @@ directory. # Post Install -Once installed, a new js-plugins directory is automatically created in -the same directory as the plugins folder. All files in the js-plugins +Once installed, a new scriptcraft/plugins directory is automatically created in +the same directory as the plugins folder. All files in the scriptcraft/plugins directory will be automatically loaded when CraftBukkit starts. *Only players who are ops can use this plugin.* You can grant a player `op` privileges by typing 'op ' at the server console prompt or @@ -94,7 +94,7 @@ javascript plugin for Minecraft. [si]: blob/master/src/main/javascript/modules/signs/menu.js A Javascript mod for minecraft is just a javascript source file (.js) -located in the craftbukkit/js-plugins directory. All .js files in this +located in the craftbukkit/plugins/scriptcraft/plugins directory. All .js files in this directory will be automatically loaded when the craftbukkit server starts. To get started writing your own mod, first take a look at some of the existing mods in the [homes][ho], [chat][ch], [arrows][ar] and diff --git a/docs/API-Reference.md b/docs/API-Reference.md index d707964..3bd5148 100644 --- a/docs/API-Reference.md +++ b/docs/API-Reference.md @@ -235,7 +235,6 @@ Walter Higgins * [utils.unwatchFile() function](#utilsunwatchfile-function) * [utils.array() function](#utilsarray-function) * [Drone Plugin](#drone-plugin) - * [TLDNR; (Just read this if you're impatient)](#tldnr-just-read-this-if-youre-impatient) * [Constructing a Drone Object](#constructing-a-drone-object) * [Drone.box() method](#dronebox-method) * [Drone.box0() method](#dronebox0-method) @@ -2928,20 +2927,6 @@ be chained together like so... var theDrone = new Drone(); theDrone.up().left().box(blocks.oak).down().fwd(3).cylinder0(blocks.lava,8); -### TLDNR; (Just read this if you're impatient) - -At the in-game command prompt type... - - /js box( blocks.oak ) - -... creates a single wooden block at the cross-hairs or player location - - /js box( blocks.oak ).right(2).box( blocks.wool.black, 4, 9, 1) - -... creates a single wooden block and a 2001 black obelisk that is 4 -wide x 9 tall x 1 long in size. If you want to see what else -ScriptCraft's Drone can do, read on... - ### Constructing a Drone Object Drones can be created in any of the following ways... @@ -3491,10 +3476,13 @@ Use this method to add new methods (which also become chainable global functions #### Parameters - * name - The name of the new method e.g. 'pyramid' + * name - The name of the new method e.g. 'pyramid'. * function - The method body. -#### Example +Alternatively if you provide just a function as a parameter, then the function name will be used as the new method name. For example the following two approaches are both valid. + + +#### Example 1 Using name and function as parameters // submitted by [edonaldson][edonaldson] Drone.extend('pyramid', function( block,height) { @@ -3505,6 +3493,16 @@ Use this method to add new methods (which also become chainable global functions return this.move('pyramid'); }); +#### Example 2 Using just a named function as a parameter + + Drone.extend(function pyramid( block,height) { + this.chkpt('pyramid'); + for ( var i = height; i > 0; i -= 2) { + this.box(block, i, 1, i).up().right().fwd(); + } + return this.move('pyramid'); + }); + Once the method is defined (it can be defined in a new pyramid.js file) it can be used like so... var d = new Drone(); diff --git a/src/main/js/lib/scriptcraft.js b/src/main/js/lib/scriptcraft.js index d901f73..7d68738 100644 --- a/src/main/js/lib/scriptcraft.js +++ b/src/main/js/lib/scriptcraft.js @@ -718,8 +718,8 @@ function __onEnable ( __engine, __plugin, __script ) legacyExists = true; - console.warn('Legacy ScriptCraft directory %s was found. This directory is no longer used.', - legacyDirs[i].canonicalPath); + console.warn('Legacy ScriptCraft directory %s was found. This directory is no longer used.',legacyDirs[i].canonicalPath); + console.warn('Please put plugins in the plugins/scriptcraft/plugins directory'); } } if ( legacyExists ) { diff --git a/src/main/js/plugins/drone/drone.js b/src/main/js/plugins/drone/drone.js index bd04253..2568d61 100644 --- a/src/main/js/plugins/drone/drone.js +++ b/src/main/js/plugins/drone/drone.js @@ -19,20 +19,6 @@ be chained together like so... var theDrone = new Drone(); theDrone.up().left().box(blocks.oak).down().fwd(3).cylinder0(blocks.lava,8); -### TLDNR; (Just read this if you're impatient) - -At the in-game command prompt type... - - /js box( blocks.oak ) - -... creates a single wooden block at the cross-hairs or player location - - /js box( blocks.oak ).right(2).box( blocks.wool.black, 4, 9, 1) - -... creates a single wooden block and a 2001 black obelisk that is 4 -wide x 9 tall x 1 long in size. If you want to see what else -ScriptCraft's Drone can do, read on... - ### Constructing a Drone Object Drones can be created in any of the following ways...