From 8496a523c3cd9d55f57036fbea7ad7e86303d246 Mon Sep 17 00:00:00 2001 From: Michael Morrison <517502+mmorrisontx@users.noreply.github.com> Date: Sat, 5 Feb 2022 19:38:15 -0600 Subject: [PATCH] Pull ping from minecraft subqueries Fixes #233 --- protocols/minecraft.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/protocols/minecraft.js b/protocols/minecraft.js index 0ea1c1d..03aa731 100644 --- a/protocols/minecraft.js +++ b/protocols/minecraft.js @@ -61,6 +61,7 @@ class Minecraft extends Core { if (bedrockState.maxplayers) state.maxplayers = bedrockState.maxplayers; if (bedrockState.players.length) state.players = bedrockState.players; if (bedrockState.map) state.map = bedrockState.map; + if (bedrockState.ping) state.ping = bedrockState.ping; } if (vanillaState) { try { @@ -79,12 +80,14 @@ class Minecraft extends Core { } catch(e) {} if (vanillaState.maxplayers) state.maxplayers = vanillaState.maxplayers; if (vanillaState.players.length) state.players = vanillaState.players; + if (vanillaState.ping) state.ping = vanillaState.ping; } if (gamespyState) { if (gamespyState.name) state.name = gamespyState.name; if (gamespyState.maxplayers) state.maxplayers = gamespyState.maxplayers; if (gamespyState.players.length) state.players = gamespyState.players; else if (gamespyState.raw.numplayers) state.players.setNum(parseInt(gamespyState.raw.numplayers)); + if (gamespyState.ping) state.ping = gamespyState.ping; } // remove dupe spaces from name state.name = state.name.replace(/\s+/g, ' ');