@scriptserver/event
TypeScript icon, indicating that this package has built-in type declarations

2.0.5 • Public • Published

@scriptserver/event

FYI: This package is an addon for ScriptServer and requires ScriptServer to be set up, please see here for more information.

useEvent(javaServer: JavaServer)

import { ScriptServer, JavaServer } from '@scriptserver/core';
import { useEvent } from '@scriptserver/event';

const javaServer = new JavaServer();
useEvent(javaServer);
// Or
const scriptServer = new ScriptServer();
useEvent(scriptServer.javaServer);

Class: JavaServer

This module does not export JavaServer, but extends it

javaServer.on('chat', (event: { player: string; message: string; }) => void)

javaServer.on('login', (event: { player: string; ip: string; }) => void)

javaServer.on('logout', (event: { player: string; reason: string; }) => void)

javaServer.on('achievement', (event: { player: string; achievement: string; }) => void)

Interface: Config

These configuration options are here to override as needed for flavors, if you are having trouble getting the events to emit in your given flavor of server, try overriding these.

  • config: Config
    • event
      • flavorSpecific
        • [flavor name]
          • parseChatEvent: (message: string) => { player: string; message: string; }
          • parseLoginEvent: (message: string) => { player: string; ip: string; }
          • parseLogoutEvent: (message: string) => { player: string; reason: string; }
          • parseAchievementEvent: (message: string) => { player: string; achievement: string; }

Package Sidebar

Install

npm i @scriptserver/event

Weekly Downloads

1

Version

2.0.5

License

GPL-3.0

Unpacked Size

16.6 kB

Total Files

18

Last publish

Collaborators

  • garrettjoecox