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
#config
config.json
#secrets
secrets.json
#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
- 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.
- 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 save = "../saveid"
var auth;
var stoppedByPlayer = false;
var timedStart;
var lastQueuePlace;
var chunkData = [];
@ -39,7 +40,7 @@ webserver.onstart(() => { // set up actions for the webserver
startQueuing();
});
webserver.onstop(() => {
stop();
stopQueing();
});
if (config.openBrowserOnStart && config.webserver) {
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 (webserver.restartQueue && proxyClient == null) { //if we have no client connected and we should restart
stop();
setTimeout(reconnect, 4000);
} else {
finishedQueue = true;
webserver.queuePlace = "FINISHED";
@ -267,7 +267,8 @@ function log(logmsg) {
function reconnect() {
doing = "reconnect"
reconnectLoop();
if (stoppedByPlayer) stoppedByPlayer = false;
else reconnectLoop();
}
function reconnectLoop() {
@ -389,7 +390,7 @@ function userInput(cmd, DiscordOrigin, discordMsg) {
case "stop":
switch (doing) {
case "queue":
stop();
stopQueing();
if (DiscordOrigin) stopMsg(DiscordOrigin, discordMsg.channel, "Queue");
else console.log("The queue is stopped");
break;
@ -499,6 +500,10 @@ function antiAntiAfkmsg() {
}, 50000)
}
function stopQueing() {
stoppedByPlayer = true;
stop();
}
module.exports = {
startQueue: function () {
startQueuing();
@ -507,6 +512,6 @@ module.exports = {
filterPacketAndSend();
},
stop: function () {
stop();
stopQueing();
}
};