Skip to content

Commit

Permalink
add doc of player.commands
Browse files Browse the repository at this point in the history
  • Loading branch information
rom1504 committed Aug 18, 2016
1 parent 38b4d4c commit 6040a4a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions doc/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
- [player.xp](#playerxp)
- [player.displayXp](#playerdisplayxp)
- [player.xpLevel](#playerxplevel)
- [player.commands](#playercommands)
- [Events](#events-2)
- ["connected"](#connected)
- ["spawned"](#spawned)
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 6040a4a

Please sign in to comment.