This repository has been archived on 2021-07-14. You can view files and clone it, but cannot push or open issues or pull requests.
scriptcraft/src/main/js/plugins/examples/example-2-hello-command.js
walterhiggins 19162c3688 First phase of transition from Bukkit to Canary.
Some of the plugins are not yet supported.
If you're feeling brave you can build from source using ant.
2014-09-29 23:42:41 +01:00

33 lines
1 KiB
JavaScript

/*************************************************************************
## 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 );
});