2.0.4 • Published 3 years ago

@scriptserver/command v2.0.4

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
3 years ago

@scriptserver/command

npm.io

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