npm.io
2.0.4 • Published 4 years ago

@scriptserver/command

Licence
GPL-3.0
Version
2.0.4
Deps
3
Size
46 kB
Vulns
0
Weekly
0
Stars
67

@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: ~)

Keywords