diff --git a/doc/API.md b/doc/API.md index 65f9a03..373cec4 100644 --- a/doc/API.md +++ b/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 ', + 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"