From 97fd450c5c18ce16aeaab027eda6797ecbff09e3 Mon Sep 17 00:00:00 2001 From: Adam Spurgeon Date: Tue, 10 Jan 2023 01:03:27 +1300 Subject: [PATCH] Fixed Minecraft resolver only reporting 0 ping. #310 Minecraft resolver now uses registerRtt rather than setting state.ping. This prevents the ping value being overwritten with 0 as shortestRTT is never set. --- protocols/minecraft.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/protocols/minecraft.js b/protocols/minecraft.js index 9f80df8..96b0783 100644 --- a/protocols/minecraft.js +++ b/protocols/minecraft.js @@ -76,20 +76,20 @@ 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 (vanillaState.ping) this.registerRtt(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; + if (gamespyState.ping) this.registerRtt(gamespyState.ping); } if (bedrockState) { if (bedrockState.name) state.name = bedrockState.name; if (bedrockState.maxplayers) state.maxplayers = bedrockState.maxplayers; if (bedrockState.map) state.map = bedrockState.map; - if (bedrockState.ping) state.ping = bedrockState.ping; + if (bedrockState.ping) this.registerRtt(bedrockState.ping); } // remove dupe spaces from name state.name = state.name.replace(/\s+/g, ' ');