diff --git a/docs/api.md b/docs/api.md index 39c1534..e9d4f18 100644 --- a/docs/api.md +++ b/docs/api.md @@ -219,6 +219,51 @@ There are a couple of special javascript variables available in ScriptCraft... * server - The Minecraft Server object. * self - the current player. (Note - this value should not be used in multi-threaded scripts - it's not thread-safe) +Drone.spiral_stairs() method +============================ +Constructs a spiral staircase with slabs at each corner. + +Parameters +---------- + + * stairBlock - The block to use for stairs, should be one of the following... + - 'oak' + - 'spruce' + - 'birch' + - 'jungle' + - 'cobblestone' + - 'brick' + - 'stone' + - 'nether' + - 'sandstone' + - 'quartz' + * flights - The number of flights of stairs to build. + +![Spiral Staircase](img/spiralstair1.png) + +Example +------- +To construct a spiral staircase 5 floors high made of oak... + + spiral_stairs('oak', 5); + +Drone.rainbow() method +====================== +Creates a Rainbow. + +Parameters +---------- + + * radius (optional - default:18) - The radius of the rainbow + +Example +------- + + var d = new Drone(); + d.rainbow(30); + +![rainbow example](img/rainbowex1.png) + Drone Module ============ The Drone is a convenience class for building. It can be used for... @@ -815,34 +860,6 @@ Used when placing torches so that they face towards the drone. drone.box( blocks.torch + ':' + Drone.PLAYER_TORCH_FACING[drone.dir]); -Drone.spiral_stairs() method -============================ -Constructs a spiral staircase with slabs at each corner. - -Parameters ----------- - - * stairBlock - The block to use for stairs, should be one of the following... - - 'oak' - - 'spruce' - - 'birch' - - 'jungle' - - 'cobblestone' - - 'brick' - - 'stone' - - 'nether' - - 'sandstone' - - 'quartz' - * flights - The number of flights of stairs to build. - -![Spiral Staircase](img/spiralstair1.png) - -Example -------- -To construct a spiral staircase 5 floors high made of oak... - - spiral_stairs('oak', 5); - Drone.sphere() method ===================== Creates a sphere. @@ -957,23 +974,6 @@ To create a 2-line high message using glowstone... [imgbt1]: img/blocktype1.png -Drone.rainbow() method -====================== -Creates a Rainbow. - -Parameters ----------- - - * radius (optional - default:18) - The radius of the rainbow - -Example -------- - - var d = new Drone(); - d.rainbow(30); - -![rainbow example](img/rainbowex1.png) - events Module ============= The Events module provides a thin wrapper around Bukkit's diff --git a/src/main/javascript/core/_scriptcraft.js b/src/main/javascript/core/_scriptcraft.js index d5f27a3..ba97f66 100644 --- a/src/main/javascript/core/_scriptcraft.js +++ b/src/main/javascript/core/_scriptcraft.js @@ -223,7 +223,7 @@ There are a couple of special javascript variables available in ScriptCraft... ***/ var global = this; -var verbose = verbose || false; +var verbose = true; //verbose || false; /* wph 20130124 - make self, plugin and server public - these are far more useful now that tab-complete works. */ @@ -325,14 +325,19 @@ var server = org.bukkit.Bukkit.server; b = _canonize(b); var aparts = (""+a).split(/\//); var bparts = (""+b).split(/\//); - var adir = aparts[aparts.length-2]; + //var adir = aparts[aparts.length-2]; + var adir = aparts.slice(0,aparts.length-1).join("/"); var afile = aparts[aparts.length-1]; - var bdir = bparts[bparts.length-2]; + //var bdir = bparts[bparts.length-2]; + var bdir = bparts.slice(0,bparts.length-1).join("/"); var bfile = bparts[bparts.length-1]; if(adirbdir) return 1; - if (afile.indexOf(adir) == 0) + + afile = afile.match(/[a-zA-Z0-9\-_]+/)[0]; + + if (adir.match(new RegExp(afile + "$"))) return -1; else return 1; @@ -616,17 +621,17 @@ var server = org.bukkit.Bukkit.server; }; /* - Unload Handlers - */ - var unloadHandlers = []; - var _addUnloadHandler = function(f) { - unloadHandlers.push(f); - } - var _runUnloadHandlers = function() { - for (var i = 0; i < unloadHandlers.length; i++) { - unloadHandlers[i](); - } - } + Unload Handlers + */ + var unloadHandlers = []; + var _addUnloadHandler = function(f) { + unloadHandlers.push(f); + } + var _runUnloadHandlers = function() { + for (var i = 0; i < unloadHandlers.length; i++) { + unloadHandlers[i](); + } + } global.load = _load; global.save = _save; @@ -658,7 +663,7 @@ var server = org.bukkit.Bukkit.server; save(pluginData.module.store, jsPluginsRootDirName + "/" + moduleName + "-store.txt"); } - _runUnloadHandlers(); + _runUnloadHandlers(); }); }()); diff --git a/src/main/javascript/drone/castle.js b/src/main/javascript/drone/contrib/castle.js similarity index 100% rename from src/main/javascript/drone/castle.js rename to src/main/javascript/drone/contrib/castle.js diff --git a/src/main/javascript/drone/chessboard.js b/src/main/javascript/drone/contrib/chessboard.js similarity index 100% rename from src/main/javascript/drone/chessboard.js rename to src/main/javascript/drone/contrib/chessboard.js diff --git a/src/main/javascript/drone/cottage.js b/src/main/javascript/drone/contrib/cottage.js similarity index 100% rename from src/main/javascript/drone/cottage.js rename to src/main/javascript/drone/contrib/cottage.js diff --git a/src/main/javascript/drone/dancefloor.js b/src/main/javascript/drone/contrib/dancefloor.js similarity index 100% rename from src/main/javascript/drone/dancefloor.js rename to src/main/javascript/drone/contrib/dancefloor.js diff --git a/src/main/javascript/drone/fort.js b/src/main/javascript/drone/contrib/fort.js similarity index 100% rename from src/main/javascript/drone/fort.js rename to src/main/javascript/drone/contrib/fort.js diff --git a/src/main/javascript/drone/logo.js b/src/main/javascript/drone/contrib/logo.js similarity index 99% rename from src/main/javascript/drone/logo.js rename to src/main/javascript/drone/contrib/logo.js index 47e7114..880a00e 100644 --- a/src/main/javascript/drone/logo.js +++ b/src/main/javascript/drone/contrib/logo.js @@ -1,4 +1,3 @@ -load(__folder + "drone.js"); // // Constructs the JS logo // https://raw.github.com/voodootikigod/logo.js/master/js.png diff --git a/src/main/javascript/drone/rainbow.js b/src/main/javascript/drone/contrib/rainbow.js similarity index 100% rename from src/main/javascript/drone/rainbow.js rename to src/main/javascript/drone/contrib/rainbow.js diff --git a/src/main/javascript/drone/spiral_stairs.js b/src/main/javascript/drone/contrib/spiral_stairs.js similarity index 100% rename from src/main/javascript/drone/spiral_stairs.js rename to src/main/javascript/drone/contrib/spiral_stairs.js diff --git a/src/main/javascript/drone/streamer.js b/src/main/javascript/drone/contrib/streamer.js similarity index 100% rename from src/main/javascript/drone/streamer.js rename to src/main/javascript/drone/contrib/streamer.js diff --git a/src/main/javascript/drone/temple.js b/src/main/javascript/drone/contrib/temple.js similarity index 100% rename from src/main/javascript/drone/temple.js rename to src/main/javascript/drone/contrib/temple.js diff --git a/src/main/javascript/signs/menu.js b/src/main/javascript/signs/menu.js index d45adca..03729b9 100644 --- a/src/main/javascript/signs/menu.js +++ b/src/main/javascript/signs/menu.js @@ -1,5 +1,3 @@ - -load(__folder + "../utils/text.js"); /* Define the signs module - signs are persistent (that is - a menu sign will still be a menu after th @@ -35,7 +33,7 @@ var signs = signs || plugin("signs", { if (offset+i < optLen) text = p_displayOptions[offset+i]; if (offset+i == p_selectedIndex) - text = ("" + text).replace(/^ /,">".white()); + text = ("" + text).replace(/^ /,">"); p_sign.setLine(i+1,text); } p_sign.update(true);