UNPKG

minecraftstatuspinger

Version:

A modern library for pinging Minecraft servers and getting their status and playerlist, written in TypeScript with zero dependencies.

52 lines 1.36 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ServerStatus = exports.Packet = void 0; class Packet { constructor() { this.status = { handshakeBaked: false, pingSent: false, pingBaked: false, pingSentTime: null, }; this.meta = { packetInitialized: false, metaCrafted: false, fieldsCrafted: false, packetID: null, dataLength: null, fullLength: null, metaLength: null, }; this.crafted = { data: null, latency: null, }; this.Error = null; } } exports.Packet = Packet; class ServerStatus { constructor(statusRaw, latency, throwOnParseError, JSONParse) { if (JSONParse) { try { this.status = JSON.parse(statusRaw); } catch (err) { if (throwOnParseError) throw err; this.status = null; } } else this.status = null; this.statusRaw = statusRaw; if (latency != null) { this.latency = latency; } else this.latency = null; } } exports.ServerStatus = ServerStatus; //# sourceMappingURL=types.js.map