UNPKG

bedrock-api

Version:

A Node.js library to retrieve information about a Minecraft Bedrock Edition server using its IP address and port.

24 lines (19 loc) 544 B
const ByteBuffer = require('bytebuffer'); const {QUERY} = require("../../config"); class StatRequest { constructor(challengeToken) { this.bb = new ByteBuffer(); this.challengeToken = challengeToken; } encode() { this.bb .append(QUERY.MAGIC, 'hex') .writeByte(QUERY.STATISTIC) .writeInt32(1) .writeInt32(this.challengeToken) .writeInt32(0) .flip() .compact(); } } module.exports = StatRequest;