Commands: /x1 <experience> <command>
Partly liveThe commands capability: /x1 <experience> commands.
#Commands: /x1
Capability commands. Typings: Commands, CommandOptions (packages/script/v1/commands.d.ts).
import { Commands } from "@x1/script";
Commands.Register("sell", async (player, args) => {
const [what, n] = args; // "/x1 fishing-ada sell pike 3"
}, { description: "Sell your catch", usage: "<fish> [count]" });
Commands.Register("reset", (p) => { /* ... */ }, { who: "creator" });#Names
- A command lives in your experience's namespace:
/x1 <experience> <name> [args]. nameis 1-24 characters ofa-z 0-9 - _and must be in your grant'snames.helpandfundbelong to the host:/x1 <experience> helplists your commands that the player may run;/x1 <experience> fund <amount>lets the creator fund the wallet (see economy.md).
/x1alone lists the experiences in the world.
An alias listed in the grant's aliases (and in its names) is also /<name>, but only when no plugin or other
sandbox already holds that label. Otherwise it stays /x1 <experience> <name>, and your sandbox log says so.
Aliases are removed when your sandbox stops.
#Who may run it
who decides who may run a command. The host checks it before your handler runs:
who | Who may run it |
|---|---|
everyone | Every player (the default) |
creator | You, plus server operators and staff holding x1.experience.<experience>.admin |
operator | Operators and that staff only |
#Arguments are data
- Arguments are split on spaces;
"double quotes"keep spaces. - At most 16 arguments of 100 characters each.
- Formatting codes, control characters, zero-width characters and bidi overrides are removed.
The host never hands them to a command dispatcher. /x1 shop buy ; op me gives your handler the strings buy, ;,
op, me and nothing else.
A player runs at most 5 commands a second.
