minecraft-client-ts
v1.0.0
Published
A Minecraft RCON client written in TypeScript
Downloads
3
Maintainers
Readme
minecraft-client-ts
A client for the Minecraft RCON protocol.
This project uses TypeScript, the Node.js runtime, Jest for testing, ESLint for linting, and CommonJS for compatibility.
Library Usage
Compile JavaScript:
npm install --include=dev
npm run build
Use the client:
import Client from "minecraft-client-ts"
import { Message } from "minecraft-client-ts"
const client: Client = new Client("127.0.0.1", 25575)
// Client methods are Promises which reject(Error) on failure.
await client.connect()
await client.authenticate("mypassword")
let resp: Message = await client.sendCommand("seed") // resp.body is "Seed: [-2474125574890692308]"
Limitations
Response bodies over 4KB will be truncated.
Starting a server for testing
docker pull itzg/minecraft-server
docker run --name=minecraft-server -p 25575:25575 -d -e EULA=TRUE itzg/minecraft-server
Running Tests
Lint and autoformat the code:
npm run lint
npm run format
Run unit tests:
npm run build
npm run test
Run integration tests after starting the test server in Docker:
npm run build
npm run test_integ
Reference
- https://wiki.vg/Rcon