@scriptserver/command
v2.0.4
Published
Module for registering custom commands that can be activated with chat messages
Downloads
37
Maintainers
Readme
@scriptserver/command
FYI: This package is an addon for ScriptServer and requires ScriptServer to be set up, please see here for more information.
useCommand(javaServer: JavaServer)
import { ScriptServer, JavaServer } from '@scriptserver/core';
import { useCommand } from '@scriptserver/command';
const javaServer = new JavaServer({
command: {
prefix: '!',
},
});
useCommand(javaServer);
// Or
const scriptServer = new ScriptServer({
command: {
prefix: '!',
},
});
useCommand(scriptServer.javaServer);
Class: JavaServer
This module does not export JavaServer, but extends it
javaServer.command(cmd: string, callback: (event: CommandEvent) => void)
javaServer.command('head', ({ player, args }) => {
javaServer.send(`give ${player} minecraft:skull 1 3 {SkullOwner:"${args[0]}"}`);
});
javaServer.on('command', (event: CommandEvent) => void)
This is exposed for advanced uses, not necssary to use this if using the javaServer.command
method.
Interface: Config
- config: Config
- command
- prefix:
string
- Prefix in chat to trigger command (default:~
)
- prefix:
- command