https://github.com/flame-development/rcon-ping
A Node.js client for checking if a Minecraft server's RCON is live and exists with the given hostname, port, and password.
https://github.com/flame-development/rcon-ping
minecraft minecraft-server net nodejs ping rcon rcon-ping
Last synced: 4 months ago
JSON representation
A Node.js client for checking if a Minecraft server's RCON is live and exists with the given hostname, port, and password.
- Host: GitHub
- URL: https://github.com/flame-development/rcon-ping
- Owner: Flame-Development
- License: mit
- Created: 2024-09-04T09:36:44.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-09T13:32:09.000Z (almost 2 years ago)
- Last Synced: 2025-08-09T14:17:14.126Z (10 months ago)
- Topics: minecraft, minecraft-server, net, nodejs, ping, rcon, rcon-ping
- Language: JavaScript
- Homepage:
- Size: 61.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://www.npmjs.com/) / [yarn](https://yarnpkg.com) / [pnpm](https://pnpm.js.org/):
```sh
npm install rcon-ping
yarn add rcon-ping
pnpm add rcon-ping
```
## Usage
Here’s an example of how to use the RconPing class:
```javascript
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.