Bug: reconnecting after stop command fixed

This commit is contained in:
MrGeorgen
2020-06-28 23:06:43 +02:00
parent e4d9921048
commit 76f1876cec
3 changed files with 12 additions and 7 deletions

3
.gitignore vendored
View File

@ -59,7 +59,8 @@ typings/
# next.js build output # next.js build output
.next .next
#config
config.json
#secrets #secrets
secrets.json secrets.json
#discord user id #discord user id

View File

@ -43,6 +43,5 @@ Do not repeatedly stop and start the queue, eventually you will not be able to l
# Known issues # Known issues
- starting the queue will revoke your minecraft token. this means that you will not be able to join normal minecraft servers until you restart the game - starting the queue will revoke your minecraft token. this means that you will not be able to join normal minecraft servers until you restart the game
- Some people report not being able to ride animals using this proxy.
- 2b2t sometimes bugs out and removes you from the queue without telling you. In this case, your queue position will no longer move. Reconnect to fix this. - 2b2t sometimes bugs out and removes you from the queue without telling you. In this case, your queue position will no longer move. Reconnect to fix this.
- If you connect after the the queue is finnished or reconnect the proxy will send cached chunk data. Otherwise you would fly in a emtpy world. Other data however like entities are not chached and will not displayed correctly. You can move out of render distance and come back to fix this issue. Sometimes the client renders a cached chunk with a blank texture. - If you connect after the the queue is finnished or reconnect the proxy will send cached chunk data. Otherwise you would fly in a emtpy world. Other data however like entities are not chached and will not displayed correctly. You can move out of render distance and come back to fix this issue. Sometimes the client renders a cached chunk with a blank texture.

View File

@ -14,6 +14,7 @@ const ping = require('minecraft-server-util');
const tokens = require('prismarine-tokens'); const tokens = require('prismarine-tokens');
const save = "../saveid" const save = "../saveid"
var auth; var auth;
var stoppedByPlayer = false;
var timedStart; var timedStart;
var lastQueuePlace; var lastQueuePlace;
var chunkData = []; var chunkData = [];
@ -39,7 +40,7 @@ webserver.onstart(() => { // set up actions for the webserver
startQueuing(); startQueuing();
}); });
webserver.onstop(() => { webserver.onstop(() => {
stop(); stopQueing();
}); });
if (config.openBrowserOnStart && config.webserver) { if (config.openBrowserOnStart && config.webserver) {
opn('http://localhost:' + config.ports.web); //open a browser window opn('http://localhost:' + config.ports.web); //open a browser window
@ -146,7 +147,6 @@ function join() {
if (chatMessage.text && chatMessage.text === "Connecting to the server...") { if (chatMessage.text && chatMessage.text === "Connecting to the server...") {
if (webserver.restartQueue && proxyClient == null) { //if we have no client connected and we should restart if (webserver.restartQueue && proxyClient == null) { //if we have no client connected and we should restart
stop(); stop();
setTimeout(reconnect, 4000);
} else { } else {
finishedQueue = true; finishedQueue = true;
webserver.queuePlace = "FINISHED"; webserver.queuePlace = "FINISHED";
@ -267,7 +267,8 @@ function log(logmsg) {
function reconnect() { function reconnect() {
doing = "reconnect" doing = "reconnect"
reconnectLoop(); if (stoppedByPlayer) stoppedByPlayer = false;
else reconnectLoop();
} }
function reconnectLoop() { function reconnectLoop() {
@ -389,7 +390,7 @@ function userInput(cmd, DiscordOrigin, discordMsg) {
case "stop": case "stop":
switch (doing) { switch (doing) {
case "queue": case "queue":
stop(); stopQueing();
if (DiscordOrigin) stopMsg(DiscordOrigin, discordMsg.channel, "Queue"); if (DiscordOrigin) stopMsg(DiscordOrigin, discordMsg.channel, "Queue");
else console.log("The queue is stopped"); else console.log("The queue is stopped");
break; break;
@ -499,6 +500,10 @@ function antiAntiAfkmsg() {
}, 50000) }, 50000)
} }
function stopQueing() {
stoppedByPlayer = true;
stop();
}
module.exports = { module.exports = {
startQueue: function () { startQueue: function () {
startQueuing(); startQueuing();
@ -507,6 +512,6 @@ module.exports = {
filterPacketAndSend(); filterPacketAndSend();
}, },
stop: function () { stop: function () {
stop(); stopQueing();
} }
}; };