1.1.0 • Published 2 years ago

@minecraft-js/rcon v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

rcon

GitHub Workflow Status GitHub npm (scoped)

RCON Minecraft client written in TypeScript

Documentation

Installation

Install the package:

$ npm install @minecraft-js/rcon

And then import it in your JavaScript/TypeScript file

const { RCONClient } = require('@minecraft-js/rcon'); // CommonJS

import { RCONClient } from '@minecraft-js/rcon'; // ES6

Connect

const client = new RCONClient('127.0.0.1', 'my_password');

client.connect();

Listen for events

client.on('authenticated', () => {
  // Do stuff
});

client.on('error', () => {
  // Do stuff
});

// ...

Execute a command

client.on('response', (requestId, packet) => {
  // Do something with requestId and packet
  // Access the command response by `packet.payload`
});

const requestId = client.executeCommand('whitelist list');

Full doc: https://minecraftjs.github.io/rcon/