forked from walterhiggins/ScriptCraft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example-2-hello-command.js
32 lines (22 loc) · 1.04 KB
/
example-2-hello-command.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*************************************************************************
## Example Plugin #2 - Making extensions available for all players.
A simple minecraft plugin. Commands for other players.
### Usage:
At the in-game prompt type ...
/jsp hello
... and a message `Hello {player-name}` will appear (where {player-name} is
replaced by your own name).
This example demonstrates the basics of adding new functionality
which is usable all players or those with the scriptcraft.proxy
permission. By default, all players are granted this permission.
This differs from example 1 in that a new 'jsp ' command extension
is defined. Since all players can use the `jsp` command, all players
can use the new extension. Unlike the previous example, the `jsp hello`
command does not evaluate javascript code so this command is much more secure.
command('hello', function (parameters, player) {
echo( player, 'Hello ' + player.name);
});
***/
command( 'hello', function( parameters, player ) {
echo( player, 'Hello ' + player.name );
});