fix issue #312 - updated slash docs and code
This commit is contained in:
parent
18add90fff
commit
9b113e2c9b
2 changed files with 22 additions and 11 deletions
|
@ -5240,7 +5240,7 @@ This function makes it easy to execute one or more minecraft commands.
|
|||
#### Parameters
|
||||
|
||||
* commands : A String or Array of strings - each string is a command to be executed.
|
||||
* sender: The player or server on whose behalf the commands should be executed.
|
||||
* sender: (optional) The player on whose behalf the commands should be executed. If not specified the commands will be executed as the server console user.
|
||||
|
||||
#### Examples
|
||||
|
||||
|
@ -5248,17 +5248,20 @@ Invoke the `/defaultgamemode creative` command (as server).
|
|||
|
||||
```javascript
|
||||
var slash = require('slash');
|
||||
slash('defaultgamemode creative', server);
|
||||
slash('defaultgamemode creative');
|
||||
```
|
||||
|
||||
Set the time of day to Midday and toggle downfall:
|
||||
Set the time of day to Midday and toggle downfall (as player 'JohnDoe'):
|
||||
|
||||
```javascript
|
||||
var slash = require('slash');
|
||||
var slash = require('slash'),
|
||||
utils = require('utils');
|
||||
var johnDoe = utils.player('John_Doe');
|
||||
|
||||
slash([
|
||||
'time set 6000',
|
||||
'toggledownfall'
|
||||
], server);
|
||||
], johnDoe);
|
||||
```
|
||||
|
||||
## Sounds Module
|
||||
|
|
|
@ -14,7 +14,7 @@ This function makes it easy to execute one or more minecraft commands.
|
|||
#### Parameters
|
||||
|
||||
* commands : A String or Array of strings - each string is a command to be executed.
|
||||
* sender: The player or server on whose behalf the commands should be executed.
|
||||
* sender: (optional) The player on whose behalf the commands should be executed. If not specified the commands will be executed as the server console user.
|
||||
|
||||
#### Examples
|
||||
|
||||
|
@ -22,17 +22,20 @@ Invoke the `/defaultgamemode creative` command (as server).
|
|||
|
||||
```javascript
|
||||
var slash = require('slash');
|
||||
slash('defaultgamemode creative', server);
|
||||
slash('defaultgamemode creative');
|
||||
```
|
||||
|
||||
Set the time of day to Midday and toggle downfall:
|
||||
Set the time of day to Midday and toggle downfall (as player 'JohnDoe'):
|
||||
|
||||
```javascript
|
||||
var slash = require('slash');
|
||||
var slash = require('slash'),
|
||||
utils = require('utils');
|
||||
var johnDoe = utils.player('John_Doe');
|
||||
|
||||
slash([
|
||||
'time set 6000',
|
||||
'toggledownfall'
|
||||
], server);
|
||||
], johnDoe);
|
||||
```
|
||||
|
||||
***/
|
||||
|
@ -51,7 +54,12 @@ function slash( commands, sender ){
|
|||
}
|
||||
}
|
||||
if (__plugin.bukkit){
|
||||
if (!sender){
|
||||
// if sender is not specified assume server console
|
||||
server.dispatchCommand(server.consoleSender, commands);
|
||||
} else {
|
||||
server.dispatchCommand(sender, commands);
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = slash;
|
||||
|
|
Reference in a new issue