From a8ad3e0444046e5d6be26a392d7868a7a1c672a7 Mon Sep 17 00:00:00 2001 From: walterhiggins Date: Fri, 7 Jun 2013 08:35:22 +0100 Subject: [PATCH] fixed api docs --- docs/api.md | 63 ++++++++++++------------ src/docs/javascript/generateApiDocs.js | 13 +++-- src/main/javascript/core/_scriptcraft.js | 1 + 3 files changed, 43 insertions(+), 34 deletions(-) diff --git a/docs/api.md b/docs/api.md index e7b4ef2..618f866 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1,34 +1,3 @@ -classroom Module -================ -Utility functions for use in a classroom setting. The goal of these -functions is to make it easier for tutors to facilitate ScriptCraft -for use by students. - -classroom.allowScripting() function -=================================== -Allow or disallow anyone who connects to the server (or is already -connected) to use ScriptCraft. This function is preferable to granting 'ops' privileges -to every student in a Minecraft classroom environment. - -Parameters ----------- - - * canScript : true or false - -Example -------- -To allow all players (and any players who connect to the server) to -use the `js` and `jsp` commands... - - /js classroom.allowScripting(true) - -To disallow scripting (and prevent players who join the server from using the commands)... - - /js classroom.allowScripting(false) - -Only ops users can run the classroom.allowScripting() function - this is so that students -don't try to bar themselves and each other from scripting. - ScriptCraft API Reference ========================= @@ -262,6 +231,38 @@ The refresh() function will ... See [issue #69][issue69] for more information. [issue69]: https://github.com/walterhiggins/ScriptCraft/issues/69 + +classroom Module +================ +Utility functions for use in a classroom setting. The goal of these +functions is to make it easier for tutors to facilitate ScriptCraft +for use by students. + +classroom.allowScripting() function +=================================== +Allow or disallow anyone who connects to the server (or is already +connected) to use ScriptCraft. This function is preferable to granting 'ops' privileges +to every student in a Minecraft classroom environment. + +Parameters +---------- + + * canScript : true or false + +Example +------- +To allow all players (and any players who connect to the server) to +use the `js` and `jsp` commands... + + /js classroom.allowScripting(true) + +To disallow scripting (and prevent players who join the server from using the commands)... + + /js classroom.allowScripting(false) + +Only ops users can run the classroom.allowScripting() function - this is so that students +don't try to bar themselves and each other from scripting. + Drone.spiral_stairs() method ============================ Constructs a spiral staircase with slabs at each corner. diff --git a/src/docs/javascript/generateApiDocs.js b/src/docs/javascript/generateApiDocs.js index aaf53e8..c4ec897 100644 --- a/src/docs/javascript/generateApiDocs.js +++ b/src/docs/javascript/generateApiDocs.js @@ -27,7 +27,8 @@ var find = function(dir,store,re) (assuming the main module is in a file with the same name as the parent directory) - e.g. drone/drone.js */ -var sortByModule = function(a,b){ +var sortByModule = function(a,b) +{ var aparts = (""+a).split(/\//); var bparts = (""+b).split(/\//); var adir = aparts[aparts.length-2]; @@ -36,6 +37,8 @@ var sortByModule = function(a,b){ var bfile = bparts[bparts.length-1]; if (afile == "_scriptcraft.js") return -1; + if (bfile == "_scriptcraft.js") + return 1; if(adirbdir) return 1; if (afile.indexOf(adir) == 0) @@ -45,9 +48,12 @@ var sortByModule = function(a,b){ }; var store = []; find(new File(dir),store,/\/[a-zA-Z0-9_\-]+\.js$/); + store.sort(sortByModule); + var contents = []; -for (var i =0; i < store.length; i++){ +for (var i =0; i < store.length; i++) +{ var br = new BufferedReader(new FileReader(store[i])); var line ; while ( (line = br.readLine()) != null){ @@ -60,7 +66,8 @@ var writeComment = false; var startComment = /^\/\*{10}/; var endComment = /^\*{3}\//; -for (var i = 0; i < len; i++) { +for (var i = 0; i < len; i++) +{ var line = contents[i]; if (line.match(startComment)){ writeComment = true; diff --git a/src/main/javascript/core/_scriptcraft.js b/src/main/javascript/core/_scriptcraft.js index 502c855..4b80da6 100644 --- a/src/main/javascript/core/_scriptcraft.js +++ b/src/main/javascript/core/_scriptcraft.js @@ -672,6 +672,7 @@ The refresh() function will ... See [issue #69][issue69] for more information. [issue69]: https://github.com/walterhiggins/ScriptCraft/issues/69 + ***/ global.refresh = function(){ __plugin.pluginLoader.disablePlugin(__plugin);