@calmdownval/mc-rcon
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Minecraft RCon Client

A simple asynchronous RCon Client for NodeJS with TypeScript support.

Installation

You will also need to install the Signal peer dependency.

# using Npm
npm install @calmdownval/mc-rcon @calmdownval/signal

# using Yarn
yarn add @calmdownval/mc-rcon @calmdownval/signal

Example Usage

This script will connect to a Minecraft Server's RCon port, log in and execute the say Hello, World! command.

import { Client } from '@calmdownval/mc-rcon';

const RCON_HOSTNAME = 'mc.your-server.com';
const RCON_PORT = 25575;
const RCON_PASSWORD = 'sup3r-s3cr3t';

(async () => {
  const client = new Client();
  try {
    await client.connect(RCON_HOSTNAME, RCON_PORT);
    await client.login(RCON_PASSWORD);
    await client.exec('say Hello, World!');
    console.info('Done!');
  }
  catch (ex) {
    console.error('An error occurred:', ex);
  }
  finally {
    await client.close();
  }
})();

Readme

Keywords

none

Package Sidebar

Install

npm i @calmdownval/mc-rcon

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

11.8 kB

Total Files

8

Last publish

Collaborators

  • calmdownval