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/javascript/plugins/examples/example-2-hello-command.js

25 lines
808 B
JavaScript

/*
A simple minecraft plugin.
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) {
player.sendMessage('Hello ' + player.name);
});