Compare commits
11 Commits
a24699cf87
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| cb8b2eb051 | |||
| df9723b4eb | |||
| 9f011a5db1 | |||
| 8c3101bc3c | |||
| a9c5071e88 | |||
| 1d0f13a522 | |||
| 76f1876cec | |||
| e4d9921048 | |||
| 833b7af2bf | |||
| e3fef4f097 | |||
| 85ca175099 |
6
.gitignore
vendored
6
.gitignore
vendored
@ -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
|
||||||
@ -67,6 +68,5 @@ saveid
|
|||||||
#hiden files
|
#hiden files
|
||||||
.idea
|
.idea
|
||||||
.project
|
.project
|
||||||
#package-lock
|
|
||||||
package-lock.json
|
|
||||||
minecraft_token.json
|
minecraft_token.json
|
||||||
|
.eslintrc.js
|
||||||
|
|||||||
22
README.md
22
README.md
@ -1,4 +1,5 @@
|
|||||||
# 2smart2wait
|
# 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)
|
A fork of the popular proxy to wait out 2b2t.org's way too long queue. [2lazy2wait](https://github.com/surprisejedi/2lazy2wait)
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
@ -14,14 +15,14 @@ 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
|
3. Open a terminal and navigate to the folder you downloaded it
|
||||||
4. Run `npm install`
|
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.
|
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.
|
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
|
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.
|
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
|
# 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'
|
2. Run `npm start`
|
||||||
3. Your bot should be online now, in discord it should show up with "Queue stopped."
|
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.
|
4. See below for commands on how to start the queue.
|
||||||
5. You can access the original 2bored2wait web interface from http://localhost
|
5. You can access the original 2bored2wait web interface from http://localhost
|
||||||
@ -30,11 +31,11 @@ A fork of the popular proxy to wait out 2b2t.org's way too long queue. [2lazy2wa
|
|||||||
|
|
||||||
# Commands
|
# Commands
|
||||||
All commands can be used through discord or the cli.
|
All commands can be used through discord or the cli.
|
||||||
- 'start' will start the queue. It takes between 15-30 seconds for the bot to update with the queue position.
|
- `start` will start the queue. It takes between 15-30 seconds for the bot to update with the queue position.
|
||||||
- 'start 14:00' will start at 2pm.
|
- `start 14:00` will start at 2pm.
|
||||||
- 'play 8:00' will try to calculate the right time to join so you can at 8:00
|
- `play 8:00` will try to calculate the right time to join so you can at 8:00
|
||||||
- 'update' will send an update to the current channel with your position and ETA.
|
- `update` will send an update to the current channel with your position and ETA.
|
||||||
- 'stop' will stop the queue.
|
- `stop` will stop the queue.
|
||||||
|
|
||||||
# Forewarning
|
# Forewarning
|
||||||
Do not give your secrets.json file to anyone under any circumstances.
|
Do not give your secrets.json file to anyone under any circumstances.
|
||||||
@ -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.
|
Do not repeatedly stop and start the queue, eventually you will not be able to log in.
|
||||||
|
|
||||||
# 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 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,
|
"discordBot": true,
|
||||||
"webserver": false,
|
"webserver": false,
|
||||||
"ports":{
|
"ports":{
|
||||||
"minecraft":25566, // port for the proxy server
|
"minecraft":25565, // port for the proxy server
|
||||||
"web":8080
|
"web":8080
|
||||||
},
|
},
|
||||||
"openBrowserOnStart": false,
|
"openBrowserOnStart": false,
|
||||||
@ -11,7 +11,7 @@
|
|||||||
"logging": true, // log errors and queue place
|
"logging": true, // log errors and queue place
|
||||||
"reconnect": {
|
"reconnect": {
|
||||||
"onError": true, // reconnect on error or if 2b2t kicks you
|
"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
|
"minecraftserver": { // the server you want to connect. Make not much sense to change it, was just added for development purpose
|
||||||
"hostname": "2b2t.org",
|
"hostname": "2b2t.org",
|
||||||
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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
package.json
12
package.json
@ -6,15 +6,15 @@
|
|||||||
"author": "MrGeorgen",
|
"author": "MrGeorgen",
|
||||||
"repository": "git://git.redstoneunion.de/MrGeorgen/2smart2wait.git",
|
"repository": "git://git.redstoneunion.de/MrGeorgen/2smart2wait.git",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "(cd src && node main.js && cd -)"
|
"start": "node src/main.js"
|
||||||
},
|
},
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"discord.js": "^11.5.1",
|
"discord.js": "^11.6.4",
|
||||||
"luxon": "^1.22.2",
|
"luxon": "^1.24.1",
|
||||||
"minecraft-protocol": "^1.11.0",
|
"minecraft-protocol": "^1.13.0",
|
||||||
"minecraft-server-util": "^1.1.0",
|
"minecraft-server-util": "^1.3.0",
|
||||||
"moment": "^2.24.0",
|
"moment": "^2.27.0",
|
||||||
"opn": "^6.0.0",
|
"opn": "^6.0.0",
|
||||||
"prismarine-tokens": "^1.0.3",
|
"prismarine-tokens": "^1.0.3",
|
||||||
"prompt": "^1.0.0"
|
"prompt": "^1.0.0"
|
||||||
|
|||||||
93
src/main.js
93
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 webserver = require('./webserver.js'); // to serve the webserver
|
||||||
const opn = require('opn'); //to open a browser window
|
const opn = require('opn'); //to open a browser window
|
||||||
const secrets = require('../secrets.json'); // read the creds
|
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 discord = require('discord.js');
|
||||||
const {DateTime} = require("luxon");
|
const {DateTime} = require("luxon");
|
||||||
const https = require("https");
|
const https = require("https");
|
||||||
const prompt = require("prompt");
|
const prompt = require("prompt");
|
||||||
const ping = require('minecraft-server-util');
|
const mc_util = require('minecraft-server-util');
|
||||||
const tokens = require('prismarine-tokens');
|
const tokens = require('prismarine-tokens');
|
||||||
const save = "../saveid"
|
const save = "./saveid"
|
||||||
var auth;
|
var stoppedByPlayer = false;
|
||||||
var timedStart;
|
var timedStart;
|
||||||
var lastQueuePlace;
|
var lastQueuePlace;
|
||||||
var chunkData = [];
|
var chunkData = [];
|
||||||
var c = 0;
|
|
||||||
var notisend = false;
|
var notisend = false;
|
||||||
var loginpacket;
|
var loginpacket;
|
||||||
var id;
|
var id;
|
||||||
@ -39,7 +38,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
|
||||||
@ -85,7 +84,7 @@ function startQueuing() {
|
|||||||
if (config.minecraftserver.onlinemode) {
|
if (config.minecraftserver.onlinemode) {
|
||||||
options.username = secrets.username;
|
options.username = secrets.username;
|
||||||
options.password = secrets.password;
|
options.password = secrets.password;
|
||||||
options.tokensLocation = "../minecraft_token.json"
|
options.tokensLocation = "./minecraft_token.json"
|
||||||
options.tokensDebug = true;
|
options.tokensDebug = true;
|
||||||
tokens.use(options, function (_err, _opts) {
|
tokens.use(options, function (_err, _opts) {
|
||||||
|
|
||||||
@ -119,7 +118,6 @@ function join() {
|
|||||||
let headermessage = JSON.parse(data.header);
|
let headermessage = JSON.parse(data.header);
|
||||||
let positioninqueue = headermessage.text.split("\n")[5].substring(25);
|
let positioninqueue = headermessage.text.split("\n")[5].substring(25);
|
||||||
webserver.queuePlace = positioninqueue; // update info on the web page
|
webserver.queuePlace = positioninqueue; // update info on the web page
|
||||||
console.log(positioninqueue);
|
|
||||||
if (webserver.queuePlace !== "None" && lastQueuePlace !== webserver.queuePlace) {
|
if (webserver.queuePlace !== "None" && lastQueuePlace !== webserver.queuePlace) {
|
||||||
if (!totalWaitTime) {
|
if (!totalWaitTime) {
|
||||||
totalWaitTime = Math.pow(positioninqueue / 35.4, 2 / 3);
|
totalWaitTime = Math.pow(positioninqueue / 35.4, 2 / 3);
|
||||||
@ -147,7 +145,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";
|
||||||
@ -182,7 +179,7 @@ function join() {
|
|||||||
proxyClient = null
|
proxyClient = null
|
||||||
}
|
}
|
||||||
stop();
|
stop();
|
||||||
log("Connection reset by 2b2t server. Reconnecting...");
|
if (!stoppedByPlayer) log("Connection reset by 2b2t server. Reconnecting...");
|
||||||
if (config.reconnect.onError) setTimeout(reconnect, 6000);
|
if (config.reconnect.onError) setTimeout(reconnect, 6000);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -209,7 +206,7 @@ function join() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
server.on('login', (newProxyClient) => { // handle login
|
server.on('login', (newProxyClient) => { // handle login
|
||||||
setTimeout(sendChunks, 50)
|
setTimeout(sendChunks, 1000)
|
||||||
if (config.antiAntiAFK) clearInterval(antiAntiAFk);
|
if (config.antiAntiAFK) clearInterval(antiAntiAFk);
|
||||||
newProxyClient.write('login', loginpacket);
|
newProxyClient.write('login', loginpacket);
|
||||||
newProxyClient.write('position', {
|
newProxyClient.write('position', {
|
||||||
@ -238,10 +235,11 @@ function join() {
|
|||||||
chunkPos.lz = chunkPos.z;
|
chunkPos.lz = chunkPos.z;
|
||||||
}
|
}
|
||||||
filterPacketAndSend(data, meta, client);
|
filterPacketAndSend(data, meta, client);
|
||||||
//console.log("meta: " + JSON.stringify(meta) + "\ndata: " + JSON.stringify(data))
|
|
||||||
});
|
});
|
||||||
newProxyClient.on("end", () => {
|
newProxyClient.on("end", () => {
|
||||||
antiAntiAfkmsg();
|
setTimeout(function(){
|
||||||
|
if (webserver.isInQueue) antiAntiAfkmsg();
|
||||||
|
},1000);
|
||||||
})
|
})
|
||||||
|
|
||||||
proxyClient = newProxyClient;
|
proxyClient = newProxyClient;
|
||||||
@ -255,26 +253,32 @@ function sendChunks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function log(logmsg) {
|
function log(logmsg) {
|
||||||
if (config.logging) fs.appendFile('../2smart2wait.log', DateTime.local().toLocaleString({
|
if (config.logging) {
|
||||||
|
fs.appendFile('../2smart2wait.log', DateTime.local().toLocaleString({
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
hour12: false
|
hour12: false
|
||||||
}) + " " + logmsg + "\n", err => {
|
}) + " " + logmsg + "\n", err => {
|
||||||
if (err) console.error(err)
|
if (err) console.error(err)
|
||||||
})
|
})
|
||||||
|
console.log(logmsg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function reconnect() {
|
function reconnect() {
|
||||||
doing = "reconnect"
|
doing = "reconnect"
|
||||||
reconnectinterval = setInterval(function () {
|
if (stoppedByPlayer) stoppedByPlayer = false;
|
||||||
ping(config.minecraftserver.hostname, config.minecraftserver.port)
|
else reconnectLoop();
|
||||||
|
}
|
||||||
|
|
||||||
|
function reconnectLoop() {
|
||||||
|
mc_util.ping(config.minecraftserver.hostname, config.minecraftserver.port)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (doing === "reconnect") startQueuing();
|
startQueuing();
|
||||||
clearInterval(reconnectinterval);
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
setTimeout(reconnectLoop, 3000);
|
||||||
});
|
});
|
||||||
}, 500)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//function to filter out some packets that would make us disconnect otherwise.
|
//function to filter out some packets that would make us disconnect otherwise.
|
||||||
@ -297,7 +301,7 @@ function activity(string) {
|
|||||||
//the discordBot part starts here.
|
//the discordBot part starts here.
|
||||||
if (config.discordBot) {
|
if (config.discordBot) {
|
||||||
fs.access(save, error => {
|
fs.access(save, error => {
|
||||||
fs.readFile(save, (err, data) => {
|
fs.readFile(save, "utf8", (err, data) => {
|
||||||
if (err) log(err)
|
if (err) log(err)
|
||||||
id = data;
|
id = data;
|
||||||
});
|
});
|
||||||
@ -332,6 +336,8 @@ function userInput(cmd, DiscordOrigin, discordMsg) {
|
|||||||
else console.log("Queue is starting up.")
|
else console.log("Queue is starting up.")
|
||||||
break;
|
break;
|
||||||
case "update":
|
case "update":
|
||||||
|
switch (doing) {
|
||||||
|
case "queue":
|
||||||
if (DiscordOrigin) discordMsg.channel.send({
|
if (DiscordOrigin) discordMsg.channel.send({
|
||||||
embed: {
|
embed: {
|
||||||
color: 3447003,
|
color: 3447003,
|
||||||
@ -359,27 +365,54 @@ function userInput(cmd, DiscordOrigin, discordMsg) {
|
|||||||
});
|
});
|
||||||
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;
|
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":
|
case "stop":
|
||||||
switch (doing) {
|
switch (doing) {
|
||||||
case "queue":
|
case "queue":
|
||||||
stop();
|
stopQueing();
|
||||||
stopMsg(DiscordOrigin, discordMsg.channel, "Queue");
|
if (DiscordOrigin) stopMsg(DiscordOrigin, discordMsg.channel, "Queue");
|
||||||
|
else console.log("The queue is stopped");
|
||||||
break;
|
break;
|
||||||
case "timedStart":
|
case "timedStart":
|
||||||
clearTimeout(timedStart);
|
clearTimeout(timedStart);
|
||||||
stopMsg(DiscordOrigin, discordMsg.channel, "Timer");
|
if (DiscordOrigin) stopMsg(DiscordOrigin, discordMsg.channel, "Timer");
|
||||||
|
else console.log("The timer is stopped");
|
||||||
break;
|
break;
|
||||||
case "reconnect":
|
case "reconnect":
|
||||||
clearInterval(reconnectinterval);
|
clearInterval(reconnectinterval);
|
||||||
stopMsg(DiscordOrigin, discordMsg.channel, "Reconnecting");
|
if (DiscordOrigin) stopMsg(DiscordOrigin, discordMsg.channel, "Reconnecting");
|
||||||
|
else console.log("Reconnecting is stoppd");
|
||||||
break;
|
break;
|
||||||
case "auth":
|
case "auth":
|
||||||
clearInterval(authInterval);
|
clearInterval(authInterval);
|
||||||
stopMsg(DiscordOrigin, discordMsg.channel, "Authentication");
|
if (DiscordOrigin) stopMsg(DiscordOrigin, discordMsg.channel, "Authentication");
|
||||||
|
else console.log("Authentication is stopped");
|
||||||
break;
|
break;
|
||||||
case "calcTime":
|
case "calcTime":
|
||||||
clearInterval(calcInterval);
|
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;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -392,10 +425,12 @@ function userInput(cmd, DiscordOrigin, discordMsg) {
|
|||||||
sendDiscordMsg(discordMsg.channel, "Timer", "Queue is starting at " + starttimestring);
|
sendDiscordMsg(discordMsg.channel, "Timer", "Queue is starting at " + starttimestring);
|
||||||
} else console.log("Queue is starting at " + starttimestring);
|
} else console.log("Queue is starting at " + starttimestring);
|
||||||
} else if (/^play (\d|[0-1]\d|2[0-3]):[0-5]\d$/.test(cmd)) {
|
} else if (/^play (\d|[0-1]\d|2[0-3]):[0-5]\d$/.test(cmd)) {
|
||||||
|
timeStringtoDateTime(cmd);
|
||||||
calcTime(cmd);
|
calcTime(cmd);
|
||||||
let output = "The perfect time to start the will be calculated, so you play at " + starttimestring;
|
let output = "The perfect time to start the will be calculated, so you play at " + starttimestring;
|
||||||
if (DiscordOrigin) sendDiscordMsg(discordMsg.channel, "time calculator", output);
|
if (DiscordOrigin) sendDiscordMsg(discordMsg.channel, "time calculator", output);
|
||||||
else console.log(output);
|
else console.log(output);
|
||||||
|
activity("You can play at " + starttimestring);
|
||||||
} else if (DiscordOrigin) discordMsg.channel.send("Error: Unknown command");
|
} else if (DiscordOrigin) discordMsg.channel.send("Error: Unknown command");
|
||||||
else console.error("Unknown command")
|
else console.error("Unknown command")
|
||||||
}
|
}
|
||||||
@ -465,6 +500,10 @@ function antiAntiAfkmsg() {
|
|||||||
}, 50000)
|
}, 50000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function stopQueing() {
|
||||||
|
stoppedByPlayer = true;
|
||||||
|
stop();
|
||||||
|
}
|
||||||
module.exports = {
|
module.exports = {
|
||||||
startQueue: function () {
|
startQueue: function () {
|
||||||
startQueuing();
|
startQueuing();
|
||||||
@ -473,6 +512,6 @@ module.exports = {
|
|||||||
filterPacketAndSend();
|
filterPacketAndSend();
|
||||||
},
|
},
|
||||||
stop: function () {
|
stop: function () {
|
||||||
stop();
|
stopQueing();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user