Compare commits
9 Commits
e3fef4f097
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| cb8b2eb051 | |||
| df9723b4eb | |||
| 9f011a5db1 | |||
| 8c3101bc3c | |||
| a9c5071e88 | |||
| 1d0f13a522 | |||
| 76f1876cec | |||
| e4d9921048 | |||
| 833b7af2bf |
6
.gitignore
vendored
6
.gitignore
vendored
@ -59,7 +59,8 @@ typings/
|
||||
|
||||
# next.js build output
|
||||
.next
|
||||
|
||||
#config
|
||||
config.json
|
||||
#secrets
|
||||
secrets.json
|
||||
#discord user id
|
||||
@ -67,6 +68,5 @@ saveid
|
||||
#hiden files
|
||||
.idea
|
||||
.project
|
||||
#package-lock
|
||||
package-lock.json
|
||||
minecraft_token.json
|
||||
.eslintrc.js
|
||||
|
||||
10
README.md
10
README.md
@ -1,4 +1,5 @@
|
||||
# 2smart2wait
|
||||
Note: This repo has been merged into the upstream [2bored2wait](https://github.com/themoonisacheese/2bored2wait)
|
||||
A fork of the popular proxy to wait out 2b2t.org's way too long queue. [2lazy2wait](https://github.com/surprisejedi/2lazy2wait)
|
||||
|
||||
# Features
|
||||
@ -14,13 +15,13 @@ A fork of the popular proxy to wait out 2b2t.org's way too long queue. [2lazy2wa
|
||||
3. Open a terminal and navigate to the folder you downloaded it
|
||||
4. Run `npm install`
|
||||
5. copy secrets.json.example and name it secrets.json. Fill out your minecraft information in the file. Note that you must use your email adress and not your minecraft username.
|
||||
6. If you so wish, edit the configuration in config.json. (On Linux ports below 1024, including port 80, require you to run the program with administrator rights.)
|
||||
6. copy config.json.example and name it config.json. If you so wish, change the config. (On Linux ports below 1024, including port 80, require you to run the program with administrator rights.)
|
||||
7. You need to create a discord bot. Search for a tutorial if you do not how to do that.
|
||||
8. Edit the file secrets.json and replace BOT_TOKEN with your bots token
|
||||
9. For trust reasons, this tool does not update automatically. Check back here once in a while to see if there are any updates.
|
||||
|
||||
# How to use
|
||||
1. Read the code to ensure i'm not stealing your credentials. i'm not, but you shouldn't take my word for it. If you don't know how to read it, downloading stuff off the internet and giving it your password is probably a bad idea anyway.
|
||||
1. Read the code to ensure I'm not stealing your credentials. I'm not, but you shouldn't take my word for it. If you don't know how to read it, downloading stuff off the internet and giving it your password is probably a bad idea anyway.
|
||||
2. Run `npm start`
|
||||
3. Your bot should be online now, in discord it should show up with "Queue stopped."
|
||||
4. See below for commands on how to start the queue.
|
||||
@ -42,7 +43,6 @@ Do not give your secrets.json file to anyone under any circumstances.
|
||||
Do not repeatedly stop and start the queue, eventually you will not be able to log in.
|
||||
|
||||
# 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.
|
||||
- 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
|
||||
- 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 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.
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"discordBot": true,
|
||||
"webserver": false,
|
||||
"ports":{
|
||||
"minecraft":25566, // port for the proxy server
|
||||
"minecraft":25565, // port for the proxy server
|
||||
"web":8080
|
||||
},
|
||||
"openBrowserOnStart": false,
|
||||
@ -11,14 +11,14 @@
|
||||
"logging": true, // log errors and queue place
|
||||
"reconnect": {
|
||||
"onError": true, // reconnect on error or if 2b2t kicks you
|
||||
"notConnectedQueueEnd": true // restart the queue if you are not connect at the end of it
|
||||
"notConnectedQueueEnd": false // restart the queue if you are not connect at the end of it
|
||||
},
|
||||
"minecraftserver": { // the server you want to connect. Make not much sense to change it, was just added for development purpose
|
||||
"hostname": "localhost",
|
||||
"hostname": "2b2t.org",
|
||||
"port": 25565,
|
||||
"renderDistance": 8,
|
||||
"version": "1.12.2",
|
||||
"onlinemode": false, // chunk caching does not work correctly if set to false
|
||||
"onlinemode": true, // chunk caching does not work correctly if set to false
|
||||
"username": "lol" // the username to use if onlinemode is false
|
||||
},
|
||||
"notification": { // sends a message via discord if the place in the queue reaches the specified number
|
||||
531
package-lock.json
generated
Normal file
531
package-lock.json
generated
Normal file
@ -0,0 +1,531 @@
|
||||
{
|
||||
"name": "2smart2wait",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"ajv": {
|
||||
"version": "6.12.2",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz",
|
||||
"integrity": "sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==",
|
||||
"requires": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
"fast-json-stable-stringify": "^2.0.0",
|
||||
"json-schema-traverse": "^0.4.1",
|
||||
"uri-js": "^4.2.2"
|
||||
}
|
||||
},
|
||||
"asn1": {
|
||||
"version": "0.2.3",
|
||||
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz",
|
||||
"integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y="
|
||||
},
|
||||
"async": {
|
||||
"version": "0.9.2",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz",
|
||||
"integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0="
|
||||
},
|
||||
"async-limiter": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
|
||||
"integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ=="
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"buffer-equal": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.0.tgz",
|
||||
"integrity": "sha1-WWFrSYME1Var1GaWayLu2j7KX74="
|
||||
},
|
||||
"centra": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/centra/-/centra-2.4.0.tgz",
|
||||
"integrity": "sha512-AWmF3EHNe/noJHviynZOrdnUuQzT5AMgl9nJPXGvnzGXrI2ZvNDrEcdqskc4EtQwt2Q1IggXb0OXy7zZ1Xvvew=="
|
||||
},
|
||||
"colors": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
|
||||
"integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA=="
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||
},
|
||||
"cycle": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz",
|
||||
"integrity": "sha1-IegLK+hYD5i0aPN5QwZisEbDStI="
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
|
||||
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"deep-equal": {
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-0.2.2.tgz",
|
||||
"integrity": "sha1-hLdFiW80xoTpjyzg5Cq69Du6AX0="
|
||||
},
|
||||
"discord.js": {
|
||||
"version": "11.6.4",
|
||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-11.6.4.tgz",
|
||||
"integrity": "sha512-cK6rH1PuGjSjpmEQbnpuTxq1Yv8B89SotyKUFcr4RhnsiZnfBfDOev7DD7v5vhtEyyj51NuMWFoRJzgy/m08Uw==",
|
||||
"requires": {
|
||||
"long": "^4.0.0",
|
||||
"prism-media": "^0.0.4",
|
||||
"snekfetch": "^3.6.4",
|
||||
"tweetnacl": "^1.0.0",
|
||||
"ws": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"endian-toggle": {
|
||||
"version": "0.0.0",
|
||||
"resolved": "https://registry.npmjs.org/endian-toggle/-/endian-toggle-0.0.0.tgz",
|
||||
"integrity": "sha1-5cx1eLEDLW7gHq/Nc3ZdsNtNwKY="
|
||||
},
|
||||
"eyes": {
|
||||
"version": "0.1.8",
|
||||
"resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz",
|
||||
"integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A="
|
||||
},
|
||||
"fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
|
||||
},
|
||||
"fast-json-stable-stringify": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
|
||||
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="
|
||||
},
|
||||
"fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
||||
},
|
||||
"glob": {
|
||||
"version": "7.1.6",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
||||
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
|
||||
"requires": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.0.4",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"i": {
|
||||
"version": "0.3.6",
|
||||
"resolved": "https://registry.npmjs.org/i/-/i-0.3.6.tgz",
|
||||
"integrity": "sha1-2WyScyB28HJxG2sQ/X1PZa2O4j0="
|
||||
},
|
||||
"inflight": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||
"requires": {
|
||||
"once": "^1.3.0",
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"is-wsl": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz",
|
||||
"integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0="
|
||||
},
|
||||
"isstream": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
|
||||
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
|
||||
},
|
||||
"json-schema-traverse": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
|
||||
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
|
||||
},
|
||||
"lodash.get": {
|
||||
"version": "4.4.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
|
||||
"integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk="
|
||||
},
|
||||
"lodash.merge": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
|
||||
"integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ=="
|
||||
},
|
||||
"lodash.reduce": {
|
||||
"version": "4.6.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.reduce/-/lodash.reduce-4.6.0.tgz",
|
||||
"integrity": "sha1-8atrg5KZrUj3hKu/R2WW8DuRTTs="
|
||||
},
|
||||
"long": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
|
||||
"integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA=="
|
||||
},
|
||||
"luxon": {
|
||||
"version": "1.24.1",
|
||||
"resolved": "https://registry.npmjs.org/luxon/-/luxon-1.24.1.tgz",
|
||||
"integrity": "sha512-CgnIMKAWT0ghcuWFfCWBnWGOddM0zu6c4wZAWmD0NN7MZTnro0+833DF6tJep+xlxRPg4KtsYEHYLfTMBQKwYg=="
|
||||
},
|
||||
"macaddress": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/macaddress/-/macaddress-0.5.1.tgz",
|
||||
"integrity": "sha512-et8b+V48uHaOB2fyNhPWwlm2PenfcfkGmHUwuVT3lxFEhfwaKwq5VmM4Cw4MYDwMrujvF0ktA2sSJidCjZBSzg=="
|
||||
},
|
||||
"minecraft-data": {
|
||||
"version": "2.58.0",
|
||||
"resolved": "https://registry.npmjs.org/minecraft-data/-/minecraft-data-2.58.0.tgz",
|
||||
"integrity": "sha512-u9kFjz8i5+8Ov8GXKuMXbKnKiebL2KZSt1/FAOEqAR6hE20QtfNzftR9VHPPkyEMDaYsMR0Ev8MMEEWMzrCpFA=="
|
||||
},
|
||||
"minecraft-protocol": {
|
||||
"version": "1.13.0",
|
||||
"resolved": "https://registry.npmjs.org/minecraft-protocol/-/minecraft-protocol-1.13.0.tgz",
|
||||
"integrity": "sha512-sD4Plkhg1JJq8gV8SHCKsUSK+Exgc15jwG4WfUZmpRcRupcB6nmz7EDoHSoNY2wLIiudfXXbXxAi69iQJqf32g==",
|
||||
"requires": {
|
||||
"buffer-equal": "^1.0.0",
|
||||
"debug": "^4.1.0",
|
||||
"endian-toggle": "^0.0.0",
|
||||
"lodash.get": "^4.1.2",
|
||||
"lodash.merge": "^4.3.0",
|
||||
"minecraft-data": "^2.58.0",
|
||||
"node-rsa": "^0.4.2",
|
||||
"prismarine-nbt": "^1.3.0",
|
||||
"protodef": "^1.8.0",
|
||||
"readable-stream": "^3.0.6",
|
||||
"uuid-1345": "^1.0.1",
|
||||
"yggdrasil": "^1.3.0"
|
||||
}
|
||||
},
|
||||
"minecraft-server-util": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/minecraft-server-util/-/minecraft-server-util-1.3.0.tgz",
|
||||
"integrity": "sha512-0IPqJBrRdVTsjjBWtQIN47GF4LhNzE4oFaJxB2JgqBZG3Si3aRB6SXtR8S8kRQHPVsqCCY8ZpsehQI6KsFkfSw=="
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "0.5.5",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
|
||||
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
|
||||
"requires": {
|
||||
"minimist": "^1.2.5"
|
||||
}
|
||||
},
|
||||
"moment": {
|
||||
"version": "2.27.0",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.27.0.tgz",
|
||||
"integrity": "sha512-al0MUK7cpIcglMv3YF13qSgdAIqxHTO7brRtaz3DlSULbqfazqkc5kEjNrLDOM7fsjshoFIihnU8snrP7zUvhQ=="
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"mute-stream": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz",
|
||||
"integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA=="
|
||||
},
|
||||
"ncp": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ncp/-/ncp-1.0.1.tgz",
|
||||
"integrity": "sha1-0VNn5cuHQyuhF9K/gP30Wuz7QkY="
|
||||
},
|
||||
"node-rsa": {
|
||||
"version": "0.4.2",
|
||||
"resolved": "https://registry.npmjs.org/node-rsa/-/node-rsa-0.4.2.tgz",
|
||||
"integrity": "sha1-1jkXKewWqDDtWjgEKzFX0tXXJTA=",
|
||||
"requires": {
|
||||
"asn1": "0.2.3"
|
||||
}
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"opn": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/opn/-/opn-6.0.0.tgz",
|
||||
"integrity": "sha512-I9PKfIZC+e4RXZ/qr1RhgyCnGgYX0UEIlXgWnCOVACIvFgaC9rz6Won7xbdhoHrd8IIhV7YEpHjreNUNkqCGkQ==",
|
||||
"requires": {
|
||||
"is-wsl": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
|
||||
},
|
||||
"phin": {
|
||||
"version": "3.4.1",
|
||||
"resolved": "https://registry.npmjs.org/phin/-/phin-3.4.1.tgz",
|
||||
"integrity": "sha512-NkBCNRPxeyrgaPlWx4DHTAdca3s2LkvIBiiG6RoSbykcOtW/pA/7rUP/67FPIinvbo7h+HENST/vJ17LdRNUdw==",
|
||||
"requires": {
|
||||
"centra": "^2.2.1"
|
||||
}
|
||||
},
|
||||
"pkginfo": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.4.1.tgz",
|
||||
"integrity": "sha1-tUGO8EOd5UJfxJlQQtztFPsqhP8="
|
||||
},
|
||||
"prism-media": {
|
||||
"version": "0.0.4",
|
||||
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-0.0.4.tgz",
|
||||
"integrity": "sha512-dG2w7WtovUa4SiYTdWn9H8Bd4JNdei2djtkP/Bk9fXq81j5Q15ZPHYSwhUVvBRbp5zMkGtu0Yk62HuMcly0pRw=="
|
||||
},
|
||||
"prismarine-nbt": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/prismarine-nbt/-/prismarine-nbt-1.3.0.tgz",
|
||||
"integrity": "sha512-QDXP3uaoZGFo0WsTq6yTxL/s+Syt/7wKhD5Jlq+2Ilfx0b8r8h6SlrashUnhgin7S2JKDytvQRRJu0aZfCHhTQ==",
|
||||
"requires": {
|
||||
"protodef": "^1.7.0"
|
||||
}
|
||||
},
|
||||
"prismarine-tokens": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/prismarine-tokens/-/prismarine-tokens-1.0.3.tgz",
|
||||
"integrity": "sha1-ffrlIJknwG6/83i7nLWdzQXFsbE=",
|
||||
"requires": {
|
||||
"yggdrasil": "git+https://github.com/zekesonxx/node-yggdrasil.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"yggdrasil": {
|
||||
"version": "git+https://github.com/zekesonxx/node-yggdrasil.git#bc9508a8384ef760f3a394f03ae9160f1c177d64",
|
||||
"from": "git+https://github.com/zekesonxx/node-yggdrasil.git",
|
||||
"requires": {
|
||||
"phin": "^3.4.1",
|
||||
"uuid": "^3.4.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"prompt": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/prompt/-/prompt-1.0.0.tgz",
|
||||
"integrity": "sha1-jlcSPDlquYiJf7Mn/Trtw+c15P4=",
|
||||
"requires": {
|
||||
"colors": "^1.1.2",
|
||||
"pkginfo": "0.x.x",
|
||||
"read": "1.0.x",
|
||||
"revalidator": "0.1.x",
|
||||
"utile": "0.3.x",
|
||||
"winston": "2.1.x"
|
||||
}
|
||||
},
|
||||
"protodef": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/protodef/-/protodef-1.8.0.tgz",
|
||||
"integrity": "sha512-D0kMc6mIgkgCy2xDeDhD15N7VRfHYphZNyqZAXRMW8Qkws0jV+ouEHaZhDbJW2rdwzXq1y7AgCzUHJlgIWIIaw==",
|
||||
"requires": {
|
||||
"lodash.get": "^4.4.2",
|
||||
"lodash.reduce": "^4.6.0",
|
||||
"protodef-validator": "^1.2.2",
|
||||
"readable-stream": "^3.0.3"
|
||||
}
|
||||
},
|
||||
"protodef-validator": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/protodef-validator/-/protodef-validator-1.2.3.tgz",
|
||||
"integrity": "sha512-dMcSMYRh8s0z0iQN0PLVlXwJOgN8cgBuM1uWzhMjkLdpKCOASwp+h7wHnTigBTRVhGLywykcb3EKiGSsXX4vvA==",
|
||||
"requires": {
|
||||
"ajv": "^6.5.4"
|
||||
}
|
||||
},
|
||||
"punycode": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
|
||||
},
|
||||
"read": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz",
|
||||
"integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=",
|
||||
"requires": {
|
||||
"mute-stream": "~0.0.4"
|
||||
}
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||
"requires": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"revalidator": {
|
||||
"version": "0.1.8",
|
||||
"resolved": "https://registry.npmjs.org/revalidator/-/revalidator-0.1.8.tgz",
|
||||
"integrity": "sha1-/s5hv6DBtSoga9axgZgYS91SOjs="
|
||||
},
|
||||
"rimraf": {
|
||||
"version": "2.7.1",
|
||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
|
||||
"integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
|
||||
"requires": {
|
||||
"glob": "^7.1.3"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
||||
},
|
||||
"snekfetch": {
|
||||
"version": "3.6.4",
|
||||
"resolved": "https://registry.npmjs.org/snekfetch/-/snekfetch-3.6.4.tgz",
|
||||
"integrity": "sha512-NjxjITIj04Ffqid5lqr7XdgwM7X61c/Dns073Ly170bPQHLm6jkmelye/eglS++1nfTWktpP6Y2bFXjdPlQqdw=="
|
||||
},
|
||||
"stack-trace": {
|
||||
"version": "0.0.10",
|
||||
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
|
||||
"integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA="
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||
"requires": {
|
||||
"safe-buffer": "~5.2.0"
|
||||
}
|
||||
},
|
||||
"tweetnacl": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz",
|
||||
"integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw=="
|
||||
},
|
||||
"uri-js": {
|
||||
"version": "4.2.2",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
|
||||
"integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
|
||||
"requires": {
|
||||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||
},
|
||||
"utile": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/utile/-/utile-0.3.0.tgz",
|
||||
"integrity": "sha1-E1LDQOuCDk2N26A5pPv6oy7U7zo=",
|
||||
"requires": {
|
||||
"async": "~0.9.0",
|
||||
"deep-equal": "~0.2.1",
|
||||
"i": "0.3.x",
|
||||
"mkdirp": "0.x.x",
|
||||
"ncp": "1.0.x",
|
||||
"rimraf": "2.x.x"
|
||||
}
|
||||
},
|
||||
"uuid": {
|
||||
"version": "3.4.0",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
|
||||
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="
|
||||
},
|
||||
"uuid-1345": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid-1345/-/uuid-1345-1.0.2.tgz",
|
||||
"integrity": "sha512-bA5zYZui+3nwAc0s3VdGQGBfbVsJLVX7Np7ch2aqcEWFi5lsAEcmO3+lx3djM1npgpZI8KY2FITZ2uYTnYUYyw==",
|
||||
"requires": {
|
||||
"macaddress": "^0.5.1"
|
||||
}
|
||||
},
|
||||
"winston": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/winston/-/winston-2.1.1.tgz",
|
||||
"integrity": "sha1-PJNJ0ZYgf9G9/51LxD73JRDjoS4=",
|
||||
"requires": {
|
||||
"async": "~1.0.0",
|
||||
"colors": "1.0.x",
|
||||
"cycle": "1.0.x",
|
||||
"eyes": "0.1.x",
|
||||
"isstream": "0.1.x",
|
||||
"pkginfo": "0.3.x",
|
||||
"stack-trace": "0.0.x"
|
||||
},
|
||||
"dependencies": {
|
||||
"async": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz",
|
||||
"integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k="
|
||||
},
|
||||
"colors": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz",
|
||||
"integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs="
|
||||
},
|
||||
"pkginfo": {
|
||||
"version": "0.3.1",
|
||||
"resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.1.tgz",
|
||||
"integrity": "sha1-Wyn2qB9wcXFC4J52W76rl7T4HiE="
|
||||
}
|
||||
}
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||
},
|
||||
"ws": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
|
||||
"integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
|
||||
"requires": {
|
||||
"async-limiter": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"yggdrasil": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/yggdrasil/-/yggdrasil-1.3.0.tgz",
|
||||
"integrity": "sha512-Soeun64VJfFlqUY99GwoHwePZEhJTAvcYPbcTaH/1pqCVqEfENuUhc8rNJlngNKrVkvZOPRIJ+T8FCKtcu6BXA==",
|
||||
"requires": {
|
||||
"phin": "^3.4.1",
|
||||
"uuid": "^3.4.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,7 +6,7 @@
|
||||
"author": "MrGeorgen",
|
||||
"repository": "git://git.redstoneunion.de/MrGeorgen/2smart2wait.git",
|
||||
"scripts": {
|
||||
"start": "(cd src && node main.js && cd -)"
|
||||
"start": "node src/main.js"
|
||||
},
|
||||
"license": "GPL-3.0-only",
|
||||
"dependencies": {
|
||||
|
||||
161
src/main.js
161
src/main.js
@ -5,19 +5,18 @@ const mc = require('minecraft-protocol'); // to handle minecraft login session
|
||||
const webserver = require('./webserver.js'); // to serve the webserver
|
||||
const opn = require('opn'); //to open a browser window
|
||||
const secrets = require('../secrets.json'); // read the creds
|
||||
const config = JSON.parse(jsonminify(fs.readFileSync("../config.json", "utf8"))); // read the config
|
||||
const config = JSON.parse(jsonminify(fs.readFileSync("./config.json", "utf8"))); // read the config
|
||||
const discord = require('discord.js');
|
||||
const {DateTime} = require("luxon");
|
||||
const https = require("https");
|
||||
const prompt = require("prompt");
|
||||
const ping = require('minecraft-server-util');
|
||||
const mc_util = require('minecraft-server-util');
|
||||
const tokens = require('prismarine-tokens');
|
||||
const save = "../saveid"
|
||||
var auth;
|
||||
const save = "./saveid"
|
||||
var stoppedByPlayer = false;
|
||||
var timedStart;
|
||||
var lastQueuePlace;
|
||||
var chunkData = [];
|
||||
var c = 0;
|
||||
var notisend = false;
|
||||
var loginpacket;
|
||||
var id;
|
||||
@ -39,7 +38,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
|
||||
@ -85,7 +84,7 @@ function startQueuing() {
|
||||
if (config.minecraftserver.onlinemode) {
|
||||
options.username = secrets.username;
|
||||
options.password = secrets.password;
|
||||
options.tokensLocation = "../minecraft_token.json"
|
||||
options.tokensLocation = "./minecraft_token.json"
|
||||
options.tokensDebug = true;
|
||||
tokens.use(options, function (_err, _opts) {
|
||||
|
||||
@ -146,7 +145,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";
|
||||
@ -181,7 +179,7 @@ function join() {
|
||||
proxyClient = null
|
||||
}
|
||||
stop();
|
||||
log("Connection reset by 2b2t server. Reconnecting...");
|
||||
if (!stoppedByPlayer) log("Connection reset by 2b2t server. Reconnecting...");
|
||||
if (config.reconnect.onError) setTimeout(reconnect, 6000);
|
||||
});
|
||||
|
||||
@ -208,7 +206,7 @@ function join() {
|
||||
});
|
||||
|
||||
server.on('login', (newProxyClient) => { // handle login
|
||||
setTimeout(sendChunks, 50)
|
||||
setTimeout(sendChunks, 1000)
|
||||
if (config.antiAntiAFK) clearInterval(antiAntiAFk);
|
||||
newProxyClient.write('login', loginpacket);
|
||||
newProxyClient.write('position', {
|
||||
@ -237,10 +235,11 @@ function join() {
|
||||
chunkPos.lz = chunkPos.z;
|
||||
}
|
||||
filterPacketAndSend(data, meta, client);
|
||||
//console.log("meta: " + JSON.stringify(meta) + "\ndata: " + JSON.stringify(data))
|
||||
});
|
||||
newProxyClient.on("end", () => {
|
||||
antiAntiAfkmsg();
|
||||
setTimeout(function(){
|
||||
if (webserver.isInQueue) antiAntiAfkmsg();
|
||||
},1000);
|
||||
})
|
||||
|
||||
proxyClient = newProxyClient;
|
||||
@ -254,26 +253,32 @@ function sendChunks() {
|
||||
}
|
||||
|
||||
function log(logmsg) {
|
||||
if (config.logging) fs.appendFile('../2smart2wait.log', DateTime.local().toLocaleString({
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
hour12: false
|
||||
}) + " " + logmsg + "\n", err => {
|
||||
if (err) console.error(err)
|
||||
})
|
||||
if (config.logging) {
|
||||
fs.appendFile('../2smart2wait.log', DateTime.local().toLocaleString({
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
hour12: false
|
||||
}) + " " + logmsg + "\n", err => {
|
||||
if (err) console.error(err)
|
||||
})
|
||||
console.log(logmsg);
|
||||
}
|
||||
}
|
||||
|
||||
function reconnect() {
|
||||
doing = "reconnect"
|
||||
reconnectinterval = setInterval(function () {
|
||||
ping(config.minecraftserver.hostname, config.minecraftserver.port)
|
||||
.then((response) => {
|
||||
if (doing === "reconnect") startQueuing();
|
||||
clearInterval(reconnectinterval);
|
||||
})
|
||||
.catch((error) => {
|
||||
});
|
||||
}, 500)
|
||||
if (stoppedByPlayer) stoppedByPlayer = false;
|
||||
else reconnectLoop();
|
||||
}
|
||||
|
||||
function reconnectLoop() {
|
||||
mc_util.ping(config.minecraftserver.hostname, config.minecraftserver.port)
|
||||
.then((response) => {
|
||||
startQueuing();
|
||||
})
|
||||
.catch((error) => {
|
||||
setTimeout(reconnectLoop, 3000);
|
||||
});
|
||||
}
|
||||
|
||||
//function to filter out some packets that would make us disconnect otherwise.
|
||||
@ -296,7 +301,7 @@ function activity(string) {
|
||||
//the discordBot part starts here.
|
||||
if (config.discordBot) {
|
||||
fs.access(save, error => {
|
||||
fs.readFile(save, (err, data) => {
|
||||
fs.readFile(save, "utf8", (err, data) => {
|
||||
if (err) log(err)
|
||||
id = data;
|
||||
});
|
||||
@ -331,54 +336,83 @@ function userInput(cmd, DiscordOrigin, discordMsg) {
|
||||
else console.log("Queue is starting up.")
|
||||
break;
|
||||
case "update":
|
||||
if (DiscordOrigin) discordMsg.channel.send({
|
||||
embed: {
|
||||
color: 3447003,
|
||||
author: {
|
||||
name: dc.user.username,
|
||||
icon_url: dc.user.avatarURL
|
||||
},
|
||||
title: "2bored2wait discord bridge",
|
||||
description: "Start and stop the queue from discord!",
|
||||
fields: [{
|
||||
name: "Position",
|
||||
value: `You are in position **${webserver.queuePlace}**.`
|
||||
},
|
||||
{
|
||||
name: "ETA",
|
||||
value: `Estimated time until login: **${webserver.ETA}**`
|
||||
switch (doing) {
|
||||
case "queue":
|
||||
if (DiscordOrigin) discordMsg.channel.send({
|
||||
embed: {
|
||||
color: 3447003,
|
||||
author: {
|
||||
name: dc.user.username,
|
||||
icon_url: dc.user.avatarURL
|
||||
},
|
||||
title: "2bored2wait discord bridge",
|
||||
description: "Start and stop the queue from discord!",
|
||||
fields: [{
|
||||
name: "Position",
|
||||
value: `You are in position **${webserver.queuePlace}**.`
|
||||
},
|
||||
{
|
||||
name: "ETA",
|
||||
value: `Estimated time until login: **${webserver.ETA}**`
|
||||
}
|
||||
],
|
||||
timestamp: new Date(),
|
||||
footer: {
|
||||
icon_url: dc.user.avatarURL,
|
||||
text: "Author: Surprisejedi"
|
||||
}
|
||||
}
|
||||
],
|
||||
timestamp: new Date(),
|
||||
footer: {
|
||||
icon_url: dc.user.avatarURL,
|
||||
text: "Author: Surprisejedi"
|
||||
}
|
||||
}
|
||||
});
|
||||
else console.log("Position: " + webserver.queuePlace + " Estimated time until login: " + webserver.ETA);
|
||||
});
|
||||
else console.log("Position: " + webserver.queuePlace + " Estimated time until login: " + webserver.ETA);
|
||||
break;
|
||||
case "timedStart":
|
||||
let timerMsg = "Timer is set to " + starttimestring;
|
||||
if (DiscordOrigin) sendDiscordMsg(discordMsg.channel, "Timer", timerMsg);
|
||||
else console.log(timerMsg);
|
||||
break;
|
||||
case "reconnect":
|
||||
let reconnectMsg = "2bt is currently offline. Trying to reconnect";
|
||||
if (DiscordOrigin) sendDiscordMsg("Reconnecting", reconnectMsg);
|
||||
else console.log(reconnectMsg);
|
||||
break;
|
||||
case "auth":
|
||||
let authMsg = "Authentication";
|
||||
if (DiscordOrigin) sendDiscordMsg(authMsg, authMsg);
|
||||
else console.log(authMsg);
|
||||
break;
|
||||
case "calcTime":
|
||||
let calcMsg = "Calculating the time, so you can paly at " + starttimestring
|
||||
if (DiscordOrigin) sendDiscordMsg("calculating time", calcMsg);
|
||||
console.log(calcMsg);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "stop":
|
||||
switch (doing) {
|
||||
case "queue":
|
||||
stop();
|
||||
stopMsg(DiscordOrigin, discordMsg.channel, "Queue");
|
||||
stopQueing();
|
||||
if (DiscordOrigin) stopMsg(DiscordOrigin, discordMsg.channel, "Queue");
|
||||
else console.log("The queue is stopped");
|
||||
break;
|
||||
case "timedStart":
|
||||
clearTimeout(timedStart);
|
||||
stopMsg(DiscordOrigin, discordMsg.channel, "Timer");
|
||||
if (DiscordOrigin) stopMsg(DiscordOrigin, discordMsg.channel, "Timer");
|
||||
else console.log("The timer is stopped");
|
||||
break;
|
||||
case "reconnect":
|
||||
clearInterval(reconnectinterval);
|
||||
stopMsg(DiscordOrigin, discordMsg.channel, "Reconnecting");
|
||||
if (DiscordOrigin) stopMsg(DiscordOrigin, discordMsg.channel, "Reconnecting");
|
||||
else console.log("Reconnecting is stoppd");
|
||||
break;
|
||||
case "auth":
|
||||
clearInterval(authInterval);
|
||||
stopMsg(DiscordOrigin, discordMsg.channel, "Authentication");
|
||||
if (DiscordOrigin) stopMsg(DiscordOrigin, discordMsg.channel, "Authentication");
|
||||
else console.log("Authentication is stopped");
|
||||
break;
|
||||
case "calcTime":
|
||||
clearInterval(calcInterval);
|
||||
stopMsg(DiscordOrigin, discordMsg.channel, "Time calculation");
|
||||
if (DiscordOrigin) stopMsg(DiscordOrigin, discordMsg.channel, "Time calculation");
|
||||
else console.log("Time calculation is stopped");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -396,6 +430,7 @@ function userInput(cmd, DiscordOrigin, discordMsg) {
|
||||
let output = "The perfect time to start the will be calculated, so you play at " + starttimestring;
|
||||
if (DiscordOrigin) sendDiscordMsg(discordMsg.channel, "time calculator", output);
|
||||
else console.log(output);
|
||||
activity("You can play at " + starttimestring);
|
||||
} else if (DiscordOrigin) discordMsg.channel.send("Error: Unknown command");
|
||||
else console.error("Unknown command")
|
||||
}
|
||||
@ -465,6 +500,10 @@ function antiAntiAfkmsg() {
|
||||
}, 50000)
|
||||
}
|
||||
|
||||
function stopQueing() {
|
||||
stoppedByPlayer = true;
|
||||
stop();
|
||||
}
|
||||
module.exports = {
|
||||
startQueue: function () {
|
||||
startQueuing();
|
||||
@ -473,6 +512,6 @@ module.exports = {
|
||||
filterPacketAndSend();
|
||||
},
|
||||
stop: function () {
|
||||
stop();
|
||||
stopQueing();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user