JSPM

rcon-ping

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q31666F
  • License MIT

A Node.js client for checking if a Minecraft server's RCON is live and exists with the given hostname, port, and password.

Package Exports

  • rcon-ping
  • rcon-ping/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rcon-ping) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

NPM Downloads npm Version

RconPing

A Node.js client for checking if a Minecraft server's RCON is live and exists with the given hostname, port, and password. Developed by Mehran1022

Features

  • Connect to a Minecraft server using RCON
  • Authenticate with the server
  • Handle errors and timeouts gracefully
  • Modular and maintainable code structure

Installation

Install with npm / yarn / pnpm:

npm install rcon-ping
yarn add rcon-ping
pnpm add rcon-ping

Usage

Here’s an example of how to use the RconPing class:

const RconPing = require('rcon-ping');

const hostname = '0.0.0.0'; // Should be enable-rcon=true in server.properties
const port = 25575; // rcon.port in server.properties
const password = 'yourpassword'; // rcon.password in server.properties

async function main() {
    const client = new RconPing(hostname, port, password)
    try {
        const result = await client.connect()
        console.log(result)
    } catch (error) {
        console.log(error.message)
    }
}
main()

Methods

RconPing constructor(hostname, port, password)

Creates a new instance of the RconPing class.

  • hostname (string): The hostname of the Minecraft server.
  • port (number): The port of the Minecraft server.
  • password (string): The RCON password for the Minecraft server.

connect() Connects to the Minecraft server and authenticates using the provided hostname, port, and password. Returns a promise that resolves with a success message or rejects with an error message.

Error Handling

The connect method provides detailed error messages for various scenarios, such as incorrect passwords, connection timeouts, and invalid responses from the server.

Contributing

Contributions are welcome! Please open an issue or submit a pull request with your changes.