mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-18 05:51:12 +00:00
add doc of player.commands
This commit is contained in:
parent
38b4d4cd29
commit
6040a4a12d
1 changed files with 24 additions and 0 deletions
24
doc/API.md
24
doc/API.md
|
|
@ -106,6 +106,7 @@
|
|||
- [player.xp](#playerxp)
|
||||
- [player.displayXp](#playerdisplayxp)
|
||||
- [player.xpLevel](#playerxplevel)
|
||||
- [player.commands](#playercommands)
|
||||
- [Events](#events-2)
|
||||
- ["connected"](#connected)
|
||||
- ["spawned"](#spawned)
|
||||
|
|
@ -681,6 +682,29 @@ Number from 0 to 1.0 representing the progress bar at the bottom of the player's
|
|||
|
||||
Level of xp the player has. Set this with player.setXpLevel()
|
||||
|
||||
#### player.commands
|
||||
|
||||
Instance of the [Command](#flying-squidcommand) class.
|
||||
Here is an example to create a new command :
|
||||
```js
|
||||
player.commands.add({
|
||||
base: 'hello',
|
||||
info: 'print hello in the console',
|
||||
usage: '/hello <pseudo>',
|
||||
op: false,
|
||||
parse(str) {
|
||||
const args=str.split(' ');
|
||||
if(args.length!=1)
|
||||
return false;
|
||||
|
||||
return {pseudo:args[0]};
|
||||
},
|
||||
action({pseudo}) {
|
||||
console.log("Hello "+pseudo);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### Events
|
||||
|
||||
#### "connected"
|
||||
|
|
|
|||
Loading…
Reference in a new issue