Fix issue #202
This commit is contained in:
parent
2fad33b35d
commit
223d7cf02b
2 changed files with 44 additions and 3 deletions
|
@ -447,6 +447,7 @@ Walter Higgins
|
|||
* [alias Plugin](#alias-plugin)
|
||||
* [Examples](#examples-2)
|
||||
* [Classroom Plugin](#classroom-plugin)
|
||||
* [jsp classroom command](#jsp-classroom-command)
|
||||
* [classroom.allowScripting() function](#classroomallowscripting-function)
|
||||
* [Commando Plugin](#commando-plugin)
|
||||
* [Description](#description)
|
||||
|
@ -5682,6 +5683,22 @@ the shared folder as follows...
|
|||
... where {serverAddress} is the ip address of the server (this is
|
||||
displayed to whoever invokes the classroom.allowScripting() function.)
|
||||
|
||||
### jsp classroom command
|
||||
The `jsp classroom` command makes it easy for tutors to turn on or off
|
||||
classroom mode. This command can only be used by server operators. To
|
||||
turn on classroom mode (enable scripting for all players):
|
||||
|
||||
jsp classroom on
|
||||
|
||||
To turn off classroom mode (disable scripting for all players):
|
||||
|
||||
jsp classroom off
|
||||
|
||||
The `jsp classroom` command is provided as an easier way to turn on or
|
||||
off classroom mode. This should be used in preference to the
|
||||
classroom.allowScripting() function which is provided only for
|
||||
programmatically enabling or disabling classroom mode.
|
||||
|
||||
### classroom.allowScripting() function
|
||||
|
||||
Allow or disallow anyone who connects to the server (or is already
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
'use strict';
|
||||
/*global require, exports, __plugin, __dirname, echo, persist, isOp, events, Packages */
|
||||
/*global require, exports, __plugin, __dirname, echo, persist, isOp, events, Packages, command */
|
||||
var utils = require('utils'),
|
||||
autoload = require('plugin').autoload,
|
||||
foreach = utils.foreach,
|
||||
|
@ -61,6 +61,22 @@ the shared folder as follows...
|
|||
... where {serverAddress} is the ip address of the server (this is
|
||||
displayed to whoever invokes the classroom.allowScripting() function.)
|
||||
|
||||
### jsp classroom command
|
||||
The `jsp classroom` command makes it easy for tutors to turn on or off
|
||||
classroom mode. This command can only be used by server operators. To
|
||||
turn on classroom mode (enable scripting for all players):
|
||||
|
||||
jsp classroom on
|
||||
|
||||
To turn off classroom mode (disable scripting for all players):
|
||||
|
||||
jsp classroom off
|
||||
|
||||
The `jsp classroom` command is provided as an easier way to turn on or
|
||||
off classroom mode. This should be used in preference to the
|
||||
classroom.allowScripting() function which is provided only for
|
||||
programmatically enabling or disabling classroom mode.
|
||||
|
||||
### classroom.allowScripting() function
|
||||
|
||||
Allow or disallow anyone who connects to the server (or is already
|
||||
|
@ -152,7 +168,7 @@ function grantScripting( player ) {
|
|||
|
||||
}
|
||||
|
||||
var classroom = {
|
||||
var _classroom = {
|
||||
allowScripting: function (/* boolean: true or false */ canScript, sender ) {
|
||||
sender = utils.player(sender);
|
||||
if ( !sender ) {
|
||||
|
@ -179,7 +195,7 @@ var classroom = {
|
|||
' for all players on server ' + serverAddress);
|
||||
}
|
||||
};
|
||||
exports.classroom = classroom;
|
||||
exports.classroom = _classroom;
|
||||
|
||||
if (__plugin.canary){
|
||||
events.connection( function( event ) {
|
||||
|
@ -194,3 +210,11 @@ if (__plugin.canary){
|
|||
}
|
||||
}, 'HIGHEST');
|
||||
}
|
||||
|
||||
command(function classroom(params, sender){
|
||||
if (params[0] == 'on'){
|
||||
_classroom.allowScripting(true, sender);
|
||||
}else {
|
||||
_classroom.allowScripting(false, sender);
|
||||
}
|
||||
},['on','off']);
|
||||
|
|
Reference in a new issue