fixed api docs
This commit is contained in:
parent
9605e32801
commit
a8ad3e0444
3 changed files with 43 additions and 34 deletions
63
docs/api.md
63
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
|
ScriptCraft API Reference
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
|
@ -262,6 +231,38 @@ The refresh() function will ...
|
||||||
See [issue #69][issue69] for more information.
|
See [issue #69][issue69] for more information.
|
||||||
|
|
||||||
[issue69]: https://github.com/walterhiggins/ScriptCraft/issues/69
|
[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
|
Drone.spiral_stairs() method
|
||||||
============================
|
============================
|
||||||
Constructs a spiral staircase with slabs at each corner.
|
Constructs a spiral staircase with slabs at each corner.
|
||||||
|
|
|
@ -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
|
(assuming the main module is in a file with the same name as the parent
|
||||||
directory) - e.g. drone/drone.js
|
directory) - e.g. drone/drone.js
|
||||||
*/
|
*/
|
||||||
var sortByModule = function(a,b){
|
var sortByModule = function(a,b)
|
||||||
|
{
|
||||||
var aparts = (""+a).split(/\//);
|
var aparts = (""+a).split(/\//);
|
||||||
var bparts = (""+b).split(/\//);
|
var bparts = (""+b).split(/\//);
|
||||||
var adir = aparts[aparts.length-2];
|
var adir = aparts[aparts.length-2];
|
||||||
|
@ -36,6 +37,8 @@ var sortByModule = function(a,b){
|
||||||
var bfile = bparts[bparts.length-1];
|
var bfile = bparts[bparts.length-1];
|
||||||
if (afile == "_scriptcraft.js")
|
if (afile == "_scriptcraft.js")
|
||||||
return -1;
|
return -1;
|
||||||
|
if (bfile == "_scriptcraft.js")
|
||||||
|
return 1;
|
||||||
if(adir<bdir) return -1;
|
if(adir<bdir) return -1;
|
||||||
if(adir>bdir) return 1;
|
if(adir>bdir) return 1;
|
||||||
if (afile.indexOf(adir) == 0)
|
if (afile.indexOf(adir) == 0)
|
||||||
|
@ -45,9 +48,12 @@ var sortByModule = function(a,b){
|
||||||
};
|
};
|
||||||
var store = [];
|
var store = [];
|
||||||
find(new File(dir),store,/\/[a-zA-Z0-9_\-]+\.js$/);
|
find(new File(dir),store,/\/[a-zA-Z0-9_\-]+\.js$/);
|
||||||
|
|
||||||
store.sort(sortByModule);
|
store.sort(sortByModule);
|
||||||
|
|
||||||
var contents = [];
|
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 br = new BufferedReader(new FileReader(store[i]));
|
||||||
var line ;
|
var line ;
|
||||||
while ( (line = br.readLine()) != null){
|
while ( (line = br.readLine()) != null){
|
||||||
|
@ -60,7 +66,8 @@ var writeComment = false;
|
||||||
var startComment = /^\/\*{10}/;
|
var startComment = /^\/\*{10}/;
|
||||||
var endComment = /^\*{3}\//;
|
var endComment = /^\*{3}\//;
|
||||||
|
|
||||||
for (var i = 0; i < len; i++) {
|
for (var i = 0; i < len; i++)
|
||||||
|
{
|
||||||
var line = contents[i];
|
var line = contents[i];
|
||||||
if (line.match(startComment)){
|
if (line.match(startComment)){
|
||||||
writeComment = true;
|
writeComment = true;
|
||||||
|
|
|
@ -672,6 +672,7 @@ The refresh() function will ...
|
||||||
See [issue #69][issue69] for more information.
|
See [issue #69][issue69] for more information.
|
||||||
|
|
||||||
[issue69]: https://github.com/walterhiggins/ScriptCraft/issues/69
|
[issue69]: https://github.com/walterhiggins/ScriptCraft/issues/69
|
||||||
|
|
||||||
***/
|
***/
|
||||||
global.refresh = function(){
|
global.refresh = function(){
|
||||||
__plugin.pluginLoader.disablePlugin(__plugin);
|
__plugin.pluginLoader.disablePlugin(__plugin);
|
||||||
|
|
Reference in a new issue