displays custom calculated ETA

This commit is contained in:
MrGeorgen
2020-04-17 17:10:37 +02:00
parent 18b329a12d
commit 2ad15dadac

View File

@ -90,11 +90,11 @@ function startQueuing() {
if (!finishedQueue && config.minecraftserver.hostname === "2b2t.org") { // if the packet contains the player list, we can use it to see our place in the queue
let headermessage = JSON.parse(data.header);
let positioninqueue = headermessage.text.split("\n")[5].substring(25);
let ETA = headermessage.text.split("\n")[6].substring(27);
webserver.queuePlace = positioninqueue; // update info on the web page
webserver.ETA = ETA;
server.motd = `Place in queue: ${positioninqueue}`; // set the MOTD because why not
if (webserver.queuePlace !== "None" && lastQueuePlace !== webserver.queuePlace) {
let ETAhour = -Math.pow(positioninqueue/35.4, 2/3)+totalWaitTime;
webserver.ETA = Math.floor(ETAhour) + "h " + ETAhour%1*60 + "m";
server.motd = `Place in queue: ${positioninqueue}`; // set the MOTD because why not
activity("Pos: " + webserver.queuePlace + " ETA: " + webserver.ETA); //set the Discord Activity
log("Position in Queue: " + webserver.queuePlace)
if (config.notification.enabled && webserver.queuePlace <= config.notification.queuePlace && !notisend && config.discordBot && id != null) {