New platform: Powernukkit #438

Merged
Sirherobrine23 merged 4 commits from powernukkit into main 2022-09-13 17:48:59 +00:00
8 changed files with 230 additions and 156 deletions
Showing only changes of commit 15a29abda0 - Show all commits

135
package-lock.json generated
View File

@ -9,7 +9,7 @@
"version": "4.0.2", "version": "4.0.2",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@the-bds-maneger/server_versions": "^3.0.1", "@the-bds-maneger/server_versions": "^4.0.1",
"adm-zip": "^0.5.9", "adm-zip": "^0.5.9",
"axios": "^0.27.2", "axios": "^0.27.2",
"cron": "^2.1.0", "cron": "^2.1.0",
@ -68,17 +68,45 @@
} }
}, },
"node_modules/@the-bds-maneger/server_versions": { "node_modules/@the-bds-maneger/server_versions": {
"version": "3.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/@the-bds-maneger/server_versions/-/server_versions-3.0.1.tgz", "resolved": "https://registry.npmjs.org/@the-bds-maneger/server_versions/-/server_versions-4.0.1.tgz",
"integrity": "sha512-PRpmjigZlfOtjVKE5371ZF0vjDV30L256hohAZYeoIWuHxzpSi6oJdT3gGp/qyUsXJ7r7Ac7A9OnFGJqgkwk5g==", "integrity": "sha512-JMJHPt4EUpWge+h8ZW7/S+B4i9ITMxDhpPD0qzoCX+O0jj12iUEM7RewVeTW5mDq0jmx3FPeaq4lMllaTowIAQ==",
"dependencies": { "dependencies": {
"axios": "^0.27.2", "axios": "^0.27.2",
"cors": "^2.8.5", "cors": "^2.8.5",
"express": "^4.18.1", "express": "^4.18.1",
"jsdom": "^20.0.0", "jsdom": "^20.0.0",
"mongoose": "^6.5.2", "mongoose": "^6.5.2",
"typescript": "^4.7.4", "yaml": "^2.1.1",
"yaml": "^2.1.1" "yargs": "^17.5.1"
},
"bin": {
"minecraft_version": "dist/bin.js"
}
},
"node_modules/@the-bds-maneger/server_versions/node_modules/yargs": {
"version": "17.5.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.5.1.tgz",
"integrity": "sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==",
"dependencies": {
"cliui": "^7.0.2",
"escalade": "^3.1.1",
"get-caller-file": "^2.0.5",
"require-directory": "^2.1.1",
"string-width": "^4.2.3",
"y18n": "^5.0.5",
"yargs-parser": "^21.0.0"
},
"engines": {
"node": ">=12"
}
},
"node_modules/@the-bds-maneger/server_versions/node_modules/yargs-parser": {
"version": "21.1.1",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
"integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
"engines": {
"node": ">=12"
} }
}, },
"node_modules/@tootallnate/once": { "node_modules/@tootallnate/once": {
@ -145,9 +173,9 @@
"dev": true "dev": true
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "18.7.16", "version": "18.7.17",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.16.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.17.tgz",
"integrity": "sha512-EQHhixfu+mkqHMZl1R2Ovuvn47PUw18azMJOTwSZr9/fhzHNGXAJ0ma0dayRVchprpCj0Kc1K1xKoWaATWF1qg==" "integrity": "sha512-0UyfUnt02zIuqp7yC8RYtDkp/vo8bFaQ13KkSEvUAohPOAlnVNbj5Fi3fgPSuwzakS+EvvnnZ4x9y7i6ASaSPQ=="
}, },
"node_modules/@types/tar": { "node_modules/@types/tar": {
"version": "6.1.2", "version": "6.1.2",
@ -303,7 +331,6 @@
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"engines": { "engines": {
"node": ">=8" "node": ">=8"
} }
@ -312,7 +339,6 @@
"version": "4.3.0", "version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"dependencies": { "dependencies": {
"color-convert": "^2.0.1" "color-convert": "^2.0.1"
}, },
@ -589,7 +615,6 @@
"version": "7.0.4", "version": "7.0.4",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
"integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
"dev": true,
"dependencies": { "dependencies": {
"string-width": "^4.2.0", "string-width": "^4.2.0",
"strip-ansi": "^6.0.0", "strip-ansi": "^6.0.0",
@ -600,7 +625,6 @@
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"dependencies": { "dependencies": {
"color-name": "~1.1.4" "color-name": "~1.1.4"
}, },
@ -611,8 +635,7 @@
"node_modules/color-name": { "node_modules/color-name": {
"version": "1.1.4", "version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
"dev": true
}, },
"node_modules/combined-stream": { "node_modules/combined-stream": {
"version": "1.0.8", "version": "1.0.8",
@ -814,8 +837,7 @@
"node_modules/emoji-regex": { "node_modules/emoji-regex": {
"version": "8.0.0", "version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
"dev": true
}, },
"node_modules/encodeurl": { "node_modules/encodeurl": {
"version": "1.0.2", "version": "1.0.2",
@ -840,7 +862,6 @@
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
"integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
"dev": true,
"engines": { "engines": {
"node": ">=6" "node": ">=6"
} }
@ -1117,7 +1138,6 @@
"version": "2.0.5", "version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"dev": true,
"engines": { "engines": {
"node": "6.* || 8.* || >= 10.*" "node": "6.* || 8.* || >= 10.*"
} }
@ -1405,7 +1425,6 @@
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"engines": { "engines": {
"node": ">=8" "node": ">=8"
} }
@ -2176,7 +2195,6 @@
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
"integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
"dev": true,
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
} }
@ -2367,7 +2385,6 @@
"version": "4.2.3", "version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"dependencies": { "dependencies": {
"emoji-regex": "^8.0.0", "emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0", "is-fullwidth-code-point": "^3.0.0",
@ -2381,7 +2398,6 @@
"version": "6.0.1", "version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"dependencies": { "dependencies": {
"ansi-regex": "^5.0.1" "ansi-regex": "^5.0.1"
}, },
@ -2570,6 +2586,7 @@
"version": "4.8.3", "version": "4.8.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.3.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.3.tgz",
"integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==", "integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==",
"dev": true,
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
"tsserver": "bin/tsserver" "tsserver": "bin/tsserver"
@ -2725,7 +2742,6 @@
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"dev": true,
"dependencies": { "dependencies": {
"ansi-styles": "^4.0.0", "ansi-styles": "^4.0.0",
"string-width": "^4.1.0", "string-width": "^4.1.0",
@ -2781,7 +2797,6 @@
"version": "5.0.8", "version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
"dev": true,
"engines": { "engines": {
"node": ">=10" "node": ">=10"
} }
@ -2896,17 +2911,38 @@
} }
}, },
"@the-bds-maneger/server_versions": { "@the-bds-maneger/server_versions": {
"version": "3.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/@the-bds-maneger/server_versions/-/server_versions-3.0.1.tgz", "resolved": "https://registry.npmjs.org/@the-bds-maneger/server_versions/-/server_versions-4.0.1.tgz",
"integrity": "sha512-PRpmjigZlfOtjVKE5371ZF0vjDV30L256hohAZYeoIWuHxzpSi6oJdT3gGp/qyUsXJ7r7Ac7A9OnFGJqgkwk5g==", "integrity": "sha512-JMJHPt4EUpWge+h8ZW7/S+B4i9ITMxDhpPD0qzoCX+O0jj12iUEM7RewVeTW5mDq0jmx3FPeaq4lMllaTowIAQ==",
"requires": { "requires": {
"axios": "^0.27.2", "axios": "^0.27.2",
"cors": "^2.8.5", "cors": "^2.8.5",
"express": "^4.18.1", "express": "^4.18.1",
"jsdom": "^20.0.0", "jsdom": "^20.0.0",
"mongoose": "^6.5.2", "mongoose": "^6.5.2",
"typescript": "^4.7.4", "yaml": "^2.1.1",
"yaml": "^2.1.1" "yargs": "^17.5.1"
},
"dependencies": {
"yargs": {
"version": "17.5.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.5.1.tgz",
"integrity": "sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==",
"requires": {
"cliui": "^7.0.2",
"escalade": "^3.1.1",
"get-caller-file": "^2.0.5",
"require-directory": "^2.1.1",
"string-width": "^4.2.3",
"y18n": "^5.0.5",
"yargs-parser": "^21.0.0"
}
},
"yargs-parser": {
"version": "21.1.1",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
"integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw=="
}
} }
}, },
"@tootallnate/once": { "@tootallnate/once": {
@ -2970,9 +3006,9 @@
"dev": true "dev": true
}, },
"@types/node": { "@types/node": {
"version": "18.7.16", "version": "18.7.17",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.16.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.17.tgz",
"integrity": "sha512-EQHhixfu+mkqHMZl1R2Ovuvn47PUw18azMJOTwSZr9/fhzHNGXAJ0ma0dayRVchprpCj0Kc1K1xKoWaATWF1qg==" "integrity": "sha512-0UyfUnt02zIuqp7yC8RYtDkp/vo8bFaQ13KkSEvUAohPOAlnVNbj5Fi3fgPSuwzakS+EvvnnZ4x9y7i6ASaSPQ=="
}, },
"@types/tar": { "@types/tar": {
"version": "6.1.2", "version": "6.1.2",
@ -3092,14 +3128,12 @@
"ansi-regex": { "ansi-regex": {
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="
"dev": true
}, },
"ansi-styles": { "ansi-styles": {
"version": "4.3.0", "version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"requires": { "requires": {
"color-convert": "^2.0.1" "color-convert": "^2.0.1"
} }
@ -3293,7 +3327,6 @@
"version": "7.0.4", "version": "7.0.4",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
"integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
"dev": true,
"requires": { "requires": {
"string-width": "^4.2.0", "string-width": "^4.2.0",
"strip-ansi": "^6.0.0", "strip-ansi": "^6.0.0",
@ -3304,7 +3337,6 @@
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"requires": { "requires": {
"color-name": "~1.1.4" "color-name": "~1.1.4"
} }
@ -3312,8 +3344,7 @@
"color-name": { "color-name": {
"version": "1.1.4", "version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
"dev": true
}, },
"combined-stream": { "combined-stream": {
"version": "1.0.8", "version": "1.0.8",
@ -3471,8 +3502,7 @@
"emoji-regex": { "emoji-regex": {
"version": "8.0.0", "version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
"dev": true
}, },
"encodeurl": { "encodeurl": {
"version": "1.0.2", "version": "1.0.2",
@ -3487,8 +3517,7 @@
"escalade": { "escalade": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
"integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw=="
"dev": true
}, },
"escape-html": { "escape-html": {
"version": "1.0.3", "version": "1.0.3",
@ -3679,8 +3708,7 @@
"get-caller-file": { "get-caller-file": {
"version": "2.0.5", "version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="
"dev": true
}, },
"get-intrinsic": { "get-intrinsic": {
"version": "1.1.2", "version": "1.1.2",
@ -3886,8 +3914,7 @@
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="
"dev": true
}, },
"is-glob": { "is-glob": {
"version": "4.0.3", "version": "4.0.3",
@ -4450,8 +4477,7 @@
"require-directory": { "require-directory": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
"integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q=="
"dev": true
}, },
"requires-port": { "requires-port": {
"version": "1.0.0", "version": "1.0.0",
@ -4598,7 +4624,6 @@
"version": "4.2.3", "version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"requires": { "requires": {
"emoji-regex": "^8.0.0", "emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0", "is-fullwidth-code-point": "^3.0.0",
@ -4609,7 +4634,6 @@
"version": "6.0.1", "version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"requires": { "requires": {
"ansi-regex": "^5.0.1" "ansi-regex": "^5.0.1"
} }
@ -4735,7 +4759,8 @@
"typescript": { "typescript": {
"version": "4.8.3", "version": "4.8.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.3.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.3.tgz",
"integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==" "integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==",
"dev": true
}, },
"universalify": { "universalify": {
"version": "0.2.0", "version": "0.2.0",
@ -4853,7 +4878,6 @@
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"dev": true,
"requires": { "requires": {
"ansi-styles": "^4.0.0", "ansi-styles": "^4.0.0",
"string-width": "^4.1.0", "string-width": "^4.1.0",
@ -4885,8 +4909,7 @@
"y18n": { "y18n": {
"version": "5.0.8", "version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="
"dev": true
}, },
"yallist": { "yallist": {
"version": "4.0.0", "version": "4.0.0",

View File

@ -30,7 +30,7 @@
"node": ">=16.0.0" "node": ">=16.0.0"
}, },
"dependencies": { "dependencies": {
"@the-bds-maneger/server_versions": "^3.0.1", "@the-bds-maneger/server_versions": "^4.0.1",
"adm-zip": "^0.5.9", "adm-zip": "^0.5.9",
"axios": "^0.27.2", "axios": "^0.27.2",
"cron": "^2.1.0", "cron": "^2.1.0",

View File

@ -4,7 +4,7 @@
* @param Proper - String with the properties or similar files * @param Proper - String with the properties or similar files
* @returns * @returns
*/ */
export function parse(Proper: string): {[key: string]: string|number|true|false|null} { export function parse<PropertiesObject = {[key: string]: string|number|true|false|null}>(Proper: string): PropertiesObject {
const ProPri = {}; const ProPri = {};
const ProperSplit = Proper.replace(/\r\n/g, "\n").replace(/\\\s+?\n/gi, "").split("\n").map(Line => Line.trim()).filter(line => /.*(\s+)?\=(\s+)?.*/.test(line) && !/^#/.test(line)); const ProperSplit = Proper.replace(/\r\n/g, "\n").replace(/\\\s+?\n/gi, "").split("\n").map(Line => Line.trim()).filter(line => /.*(\s+)?\=(\s+)?.*/.test(line) && !/^#/.test(line));
for (const Line of ProperSplit) { for (const Line of ProperSplit) {
@ -17,7 +17,7 @@ export function parse(Proper: string): {[key: string]: string|number|true|false|
else if (/^[0-9]+\.[0-9]+/.test(ProPri[key]) && !/^[0-9]+\.[0-9]+\.[0-9]+/.test(ProPri[key])) ProPri[key] = parseFloat(ProPri[key]); else if (/^[0-9]+\.[0-9]+/.test(ProPri[key]) && !/^[0-9]+\.[0-9]+\.[0-9]+/.test(ProPri[key])) ProPri[key] = parseFloat(ProPri[key]);
else if (/^[0-9]+/.test(ProPri[key])) ProPri[key] = parseInt(ProPri[key]); else if (/^[0-9]+/.test(ProPri[key])) ProPri[key] = parseInt(ProPri[key]);
} }
return ProPri; return ProPri as PropertiesObject;
} }
/** /**

View File

@ -2,11 +2,12 @@ import * as path from "node:path";
import * as fsOld from "node:fs"; import * as fsOld from "node:fs";
import * as fs from "node:fs/promises"; import * as fs from "node:fs/promises";
import { promisify } from "node:util"; import { promisify } from "node:util";
import { getBedrockZip } from "@the-bds-maneger/server_versions"; import { platformManeger } from "@the-bds-maneger/server_versions";
import admZip from "adm-zip"; import admZip from "adm-zip";
import { exec, execAsync } from "./childPromisses"; import { exec, execAsync } from "./childPromisses";
import { actions, actionConfig } from "./globalPlatfroms"; import { actions, actionConfig } from "./globalPlatfroms";
import { serverRoot, logRoot } from './pathControl'; import { serverRoot, logRoot } from './pathControl';
import * as Proprieties from "./Proprieties";
export const serverPath = path.join(serverRoot, "Bedrock"); export const serverPath = path.join(serverRoot, "Bedrock");
export { bedrockServerWorld, bedrockWorld, linkBedrock } from "./linkWorld"; export { bedrockServerWorld, bedrockWorld, linkBedrock } from "./linkWorld";
@ -21,11 +22,7 @@ export const player = /\[.*\]\s+Player\s+((dis|)connected):\s+(.*),\s+xuid:\s+([
export const compressWorld = /\[.*\]\s+Running\s+AutoCompaction/; export const compressWorld = /\[.*\]\s+Running\s+AutoCompaction/;
export async function installServer(version: string|boolean) { export async function installServer(version: string|boolean) {
let arch = process.arch; const zip = new admZip(await platformManeger.bedrock.getBedrockZip(version, {}));
if (process.platform === "linux" && process.arch !== "x64") {
if (await execAsync("command -v qemu-x86_64-static").then(() => true).catch(() => false)||await execAsync("command -v box64").then(() => true).catch(() => false)) arch = "x64";
}
const zip = new admZip(await getBedrockZip(version, arch));
if (!fsOld.existsSync(serverPath)) await fs.mkdir(serverPath, {recursive: true}); if (!fsOld.existsSync(serverPath)) await fs.mkdir(serverPath, {recursive: true});
// Remover files // Remover files
for (const file of await fs.readdir(serverPath).then(files => files.filter(file => !saveFileFolder.test(file)))) await fs.rm(path.join(serverPath, file), {recursive: true, force: true}); for (const file of await fs.readdir(serverPath).then(files => files.filter(file => !saveFileFolder.test(file)))) await fs.rm(path.join(serverPath, file), {recursive: true, force: true});
@ -102,4 +99,141 @@ export async function startServer() {
const logFileOut = path.join(logRoot, `bdsManeger_${Date.now()}_bedrock_${process.platform}_${process.arch}.stdout.log`); const logFileOut = path.join(logRoot, `bdsManeger_${Date.now()}_bedrock_${process.platform}_${process.arch}.stdout.log`);
return new actions(exec(command, args, {cwd: serverPath, maxBuffer: Infinity, env: {LD_LIBRARY_PATH: process.platform === "win32"?undefined:serverPath}, logPath: {stdout: logFileOut}}), serverConfig); return new actions(exec(command, args, {cwd: serverPath, maxBuffer: Infinity, env: {LD_LIBRARY_PATH: process.platform === "win32"?undefined:serverPath}, logPath: {stdout: logFileOut}}), serverConfig);
}
// File config
export const fileProperties = path.join(serverPath, "server.properties");
// Update file config
export type keyConfig = "serverName"|"gamemode"|"forceGamemode"|"difficulty"|"allowCheats"|"maxPlayers"|"onlineMode"|"allowList"|"serverPort"|"serverPortv6"|"viewDistance"|"tickDistance"|"playerIdleTimeout"|"maxThreads"|"levelName"|"levelSeed"|"defaultPlayerPermissionLevel"|"texturepackRequired"|"chatRestriction";
export async function updateFile(key: "serverName", value: string): Promise<string>;
export async function updateFile(key: "gamemode", value: "survival"|"creative"|"adventure"): Promise<string>;
export async function updateFile(key: "forceGamemode", value: boolean): Promise<string>;
export async function updateFile(key: "difficulty", value: "peaceful"|"easy"|"normal"|"hard"): Promise<string>;
export async function updateFile(key: "allowCheats", value: boolean): Promise<string>;
export async function updateFile(key: "maxPlayers", value: number): Promise<string>;
export async function updateFile(key: "onlineMode", value: boolean): Promise<string>;
export async function updateFile(key: "allowList", value: boolean): Promise<string>;
export async function updateFile(key: "serverPort", value: number): Promise<string>;
export async function updateFile(key: "serverPortv6", value: number): Promise<string>;
export async function updateFile(key: "viewDistance", value: number): Promise<string>;
export async function updateFile(key: "tickDistance", value: "4"|"6"|"8"|"10"|"12"): Promise<string>;
export async function updateFile(key: "playerIdleTimeout", value: number): Promise<string>;
export async function updateFile(key: "maxThreads", value: number): Promise<string>;
export async function updateFile(key: "levelName", value: string): Promise<string>;
export async function updateFile(key: "levelSeed", value?: string): Promise<string>;
export async function updateFile(key: "defaultPlayerPermissionLevel", value: "visitor"|"member"|"operator"): Promise<string>;
export async function updateFile(key: "texturepackRequired", value: boolean): Promise<string>;
export async function updateFile(key: "chatRestriction", value: "None"|"Dropped"|"Disabled"): Promise<string>;
export async function updateFile(key: keyConfig, value: string|number|boolean): Promise<string> {
if (!fsOld.existsSync(fileProperties)) throw new Error("Install server fist!");
let fileConfig = await fs.readFile(fileProperties, "utf8");
if (key === "serverName") fileConfig = fileConfig.replace(/server-name=.*/, `server-name=${value}`);
else if (key === "gamemode") fileConfig = fileConfig.replace(/gamemode=(survival|creative|adventure)/, `gamemode=${value}`);
else if (key === "forceGamemode") fileConfig = fileConfig.replace(/force-gamemode=(true|false)/, `force-gamemode=${value}`);
else if (key === "difficulty") fileConfig = fileConfig.replace(/difficulty=(peaceful|easy|normal|hard)/, `difficulty=${value}`);
else if (key === "allowCheats") fileConfig = fileConfig.replace(/allow-cheats=(false|true)/, `allow-cheats=${value}`);
else if (key === "maxPlayers") fileConfig = fileConfig.replace(/max-players=[0-9]+/, `max-players=${value}`);
else if (key === "onlineMode") fileConfig = fileConfig.replace(/online-mode=(true|false)/, `online-mode=${value}`);
else if (key === "allowList") fileConfig = fileConfig.replace(/allow-list=(false|true)/, `allow-list=${value}`);
else if (key === "serverPort"||key === "serverPortv6") {
if (value > 1 && 65535 < value) {
if (key === "serverPort") fileConfig = fileConfig.replace(/server-port=[0-9]+/, `server-port=${value}`);
else fileConfig = fileConfig.replace(/server-portv6=[0-9]+/, `server-portc6=${value}`);
} else throw new Error("Invalid port range");
}
else if (key === "viewDistance") {
if (value > 4) fileConfig = fileConfig.replace(/view-distance=[0-9]+/, `view-distance=${value}`);
else throw new Error("integer equal to 5 or greater");
} else if (key === "tickDistance") fileConfig = fileConfig.replace(/tick-distance=(4|6|8|10|12)/, `tick-distance=${value}`);
else if (key === "playerIdleTimeout") fileConfig = fileConfig.replace(/player-idle-timeout=[0-9]+/, `player-idle-timeout=${value}`);
else if (key === "maxThreads") fileConfig = fileConfig.replace(/max-threads=[0-9]+/, `max-threads=${value}`);
else if (key === "levelName") fileConfig = fileConfig.replace(/level-name=.*/, `level-name=${value}`);
else if (key === "levelSeed") fileConfig = fileConfig.replace(/level-seed=.*/, `level-seed=${!value?"":value}`);
else if (key === "defaultPlayerPermissionLevel") fileConfig = fileConfig.replace(/default-player-permission-level=(visitor|member|operator)/, `default-player-permission-level=${value}`);
else if (key === "texturepackRequired") fileConfig = fileConfig.replace(/texturepack-required=(false|true)/, `texturepack-required=${value}`);
else if (key === "chatRestriction") fileConfig = fileConfig.replace(/chat-restriction=(None|Dropped|Disabled)/, `chat-restriction=${value}`);
else throw new Error("Invalid key");
await fs.writeFile(fileProperties, fileConfig);
return fileConfig;
}
export type bedrockConfig = {
"serverName"?: string,
"gamemode"?: "survival"|"creative"|"adventure",
"forceGamemode"?: boolean,
"difficulty"?: "peaceful"|"easy"|"normal"|"hard",
"allowCheats"?: boolean,
"maxPlayers"?: number,
"onlineMode"?: boolean,
"allowList"?: boolean,
"serverPort"?: number,
"serverPortv6"?: number,
"viewDistance"?: number,
"tickDistance"?: "4"|"6"|"8"|"10"|"12",
"playerIdleTimeout"?: number,
"maxThreads"?: number,
"levelName"?: string,
"levelSeed"?: string,
"defaultPlayerPermissionLevel"?: "visitor"|"member"|"operator",
"texturepackRequired"?: boolean,
"chatRestriction"?: "None"|"Dropped"|"Disabled"
};
type rawConfig = {
'server-name': string,
gamemode: string,
'force-gamemode': boolean,
difficulty: string,
'allow-cheats': boolean,
'max-players': number,
'online-mode': true,
'allow-list': boolean,
'server-port': number,
'server-portv6': number,
'view-distance': number,
'tick-distance': number,
'player-idle-timeout': number,
'max-threads': number,
'level-name': string,
'level-seed': any,
'default-player-permission-level': string,
'texturepack-required': boolean,
'content-log-file-enabled': boolean,
'compression-threshold': number,
'server-authoritative-movement': string,
'player-movement-score-threshold': number,
'player-movement-action-direction-threshold': number,
'player-movement-distance-threshold': number,
'player-movement-duration-threshold-in-ms': number,
'correct-player-movement': boolean,
'server-authoritative-block-breaking': boolean,
'chat-restriction': string,
'disable-player-interaction': boolean
}
export async function getConfig(): Promise<bedrockConfig> {
if (!fsOld.existsSync(fileProperties)) throw new Error("Install server fist");
const config = Proprieties.parse<rawConfig>(await fs.readFile(fileProperties, "utf8"));
const configBase: bedrockConfig = {};
const ignore = [
"content-log-file-enabled",
"compression-threshold",
"server-authoritative-movement",
"player-movement-score-threshold",
"player-movement-action-direction-threshold",
"player-movement-distance-threshold",
"player-movement-duration-threshold-in-ms",
"correct-player-movement",
"server-authoritative-block-breaking",
"disable-player-interaction"
]
for (const configKey of Object.keys(config)) {
if (ignore.includes(configKey)) continue;
const key = configKey.replace(/-(.)/g, (_, _1) => _1.toUpperCase());
if (key === "levelSeed" && config[configKey] === null) configBase[key] = "";
else configBase[key] = config[configKey];
}
return configBase;
} }

View File

@ -1,83 +0,0 @@
import { readFile } from "node:fs/promises";
import {} from "prismarine-nbt";
import { serverPath } from "../bedrock";
import * as Proprieties from "./Proprieties";
import * as path from 'node:path';
export type bedrockParseProprieties = {
"server-name": string,
gamemode: "survival"|"creative"|"adventure",
"force-gamemode": boolean,
difficulty: "peaceful"|"easy"|"normal"|"hard",
"allow-cheats": boolean,
"max-players": number,
"online-mode": boolean,
"allow-list": boolean,
"server-port": number,
"server-portv6": number,
"view-distance": number,
"tick-distance": 4|6|8|10|12,
"player-idle-timeout": number,
"max-threads": number,
"level-name": string,
"level-seed": string|number|bigint|null,
"default-player-permission-level": "visitor"|"member"|"operator",
"texturepack-required": boolean,
"content-log-file-enabled": boolean,
"compression-threshold": number,
"server-authoritative-movement": "client-auth"|"server-auth"|"server-auth-with-rewind",
"player-movement-score-threshold": number,
"player-movement-action-direction-threshold": number,
"player-movement-distance-threshold": number,
"player-movement-duration-threshold-in-ms": number,
"correct-player-movement": boolean,
"server-authoritative-block-breaking": boolean,
"chat-restriction": "None"|"Dropped"|"Disabled",
"disable-player-interaction": boolean
};
export async function getConfig(): Promise<bedrockParseProprieties> {
return Proprieties.parse(await readFile(path.join(serverPath, "server.proprieties"), "utf8")) as bedrockParseProprieties;
}
const keys = RegExp("("+(["server-name", "gamemode", "force-gamemode", "difficulty", "allow-cheats", "max-players", "online-mode", "allow-list", "server-port", "server-portv6", "view-distance", "tick-distance", "player-idle-timeout", "max-threads", "level-name", "level-seed", "default-player-permission-level", "texturepack-required", "content-log-file-enabled", "compression-threshold", "server-authoritative-movement", "player-movement-score-threshold", "player-movement-action-direction-threshold", "player-movement-distance-threshold", "player-movement-duration-threshold-in-ms", "correct-player-movement", "server-authoritative-block-breaking", "chat-restriction", "disable-player-interaction"]).join("|")+")")
export function createConfig(config: bedrockParseProprieties): string {
let configString = "";
for (const key of Object.keys(config).filter(a => keys.test(a))) configString += `${key}=${config[key]}\n`;
return configString.trim();
}
/*
console.log(createConfig({
"server-name": "string",
gamemode: "survival",
"force-gamemode": true,
difficulty: "easy",
"allow-cheats": false,
"max-players": 20,
"online-mode": false,
"allow-list": true,
"server-port": 19135,
"server-portv6": 19136,
"view-distance": 32,
"tick-distance": 8,
"player-idle-timeout": 0,
"max-threads": 16,
"level-name": "string",
"level-seed": null,
"default-player-permission-level": "member",
"texturepack-required": true,
"content-log-file-enabled": false,
"compression-threshold": 0,
"server-authoritative-movement": "server-auth-with-rewind",
"player-movement-score-threshold": 0.9,
"player-movement-action-direction-threshold": 0.6,
"player-movement-distance-threshold": 0.6,
"player-movement-duration-threshold-in-ms": 0.6,
"correct-player-movement": false,
"server-authoritative-block-breaking": false,
"chat-restriction": "Disabled",
"disable-player-interaction": false
}));
*/

View File

@ -1,7 +1,7 @@
import * as path from "node:path"; import * as path from "node:path";
import * as fs from "node:fs/promises"; import * as fs from "node:fs/promises";
import * as fsOld from "node:fs"; import * as fsOld from "node:fs";
import { getJavaJar } from "@the-bds-maneger/server_versions"; import { platformManeger } from "@the-bds-maneger/server_versions";
import { serverRoot, logRoot } from './pathControl'; import { serverRoot, logRoot } from './pathControl';
import { exec } from "./childPromisses"; import { exec } from "./childPromisses";
import { actions, actionConfig } from './globalPlatfroms'; import { actions, actionConfig } from './globalPlatfroms';
@ -13,7 +13,7 @@ export const portListen = /\[.*\]:\s+Starting\s+Minecraft\s+server\s+on\s+(([0-9
export async function installServer(version: string|boolean) { export async function installServer(version: string|boolean) {
if (!fsOld.existsSync(serverPath)) await fs.mkdir(serverPath, {recursive: true}); if (!fsOld.existsSync(serverPath)) await fs.mkdir(serverPath, {recursive: true});
await fs.writeFile(jarPath, await getJavaJar(version)); await fs.writeFile(jarPath, await platformManeger.java.getJar(version));
} }
const serverConfig: actionConfig[] = [ const serverConfig: actionConfig[] = [
@ -35,7 +35,7 @@ const serverConfig: actionConfig[] = [
port: parseInt(port), port: parseInt(port),
type: "TCP", type: "TCP",
host: host, host: host,
protocol: /::/.test(host?.trim())?"IPv6":/[0-9]+\.[0-9]+/.test(host?.trim())?"IPv4":"IPV4/IPv6" protocol: "IPV4/IPv6"
}); });
} }
}, },

View File

@ -3,7 +3,7 @@ import * as fs from "node:fs/promises";
import * as os from "node:os"; import * as os from "node:os";
import * as tar from "tar"; import * as tar from "tar";
import { existsSync as fsExistsSync } from "node:fs"; import { existsSync as fsExistsSync } from "node:fs";
import { getPocketminePhar, versionAPIs } from "@the-bds-maneger/server_versions"; import { platformManeger, versionURLs } from "@the-bds-maneger/server_versions";
import { execFileAsync, exec } from './childPromisses'; import { execFileAsync, exec } from './childPromisses';
import { logRoot, serverRoot } from "./pathControl"; import { logRoot, serverRoot } from "./pathControl";
import { getBuffer } from "./httpRequest"; import { getBuffer } from "./httpRequest";
@ -53,7 +53,7 @@ async function buildPhp() {
} }
async function installPhp(): Promise<void> { async function installPhp(): Promise<void> {
const file = (await getBuffer(`${versionAPIs[0]}/pocketmine/bin?os=${process.platform}&arch=${process.arch}`).then(res => JSON.parse(res.toString("utf8")) as {url: string, name: string}[]))[0]; const file = (await getBuffer(`${versionURLs[0]}/pocketmine/bin?os=${process.platform}&arch=${process.arch}`).then(res => JSON.parse(res.toString("utf8")) as {url: string, name: string}[]))[0];
if (!file) return buildPhp(); if (!file) return buildPhp();
if (fsExistsSync(path.resolve(serverPath, "bin"))) await fs.rm(path.resolve(serverPath, "bin"), {recursive: true}); if (fsExistsSync(path.resolve(serverPath, "bin"))) await fs.rm(path.resolve(serverPath, "bin"), {recursive: true});
await fs.mkdir(path.resolve(serverPath, "bin"), {recursive: true}); await fs.mkdir(path.resolve(serverPath, "bin"), {recursive: true});
@ -83,7 +83,7 @@ async function installPhp(): Promise<void> {
export async function installServer(version: string|boolean) { export async function installServer(version: string|boolean) {
if (!fsExistsSync(serverPath)) await fs.mkdir(serverPath, {recursive: true}); if (!fsExistsSync(serverPath)) await fs.mkdir(serverPath, {recursive: true});
await installPhp(); await installPhp();
await fs.writeFile(serverPhar, await getPocketminePhar(version)); await fs.writeFile(serverPhar, await platformManeger.pocketmine.getPhar(version));
} }
// [16:47:35.405] [Server thread/INFO]: Minecraft network interface running on 0.0.0.0:19132 // [16:47:35.405] [Server thread/INFO]: Minecraft network interface running on 0.0.0.0:19132

View File

@ -1,7 +1,7 @@
import * as path from "node:path"; import * as path from "node:path";
import * as fs from "node:fs/promises"; import * as fs from "node:fs/promises";
import * as fsOld from "node:fs"; import * as fsOld from "node:fs";
import { getSpigotJar } from "@the-bds-maneger/server_versions"; import { platformManeger } from "@the-bds-maneger/server_versions";
import { serverRoot, logRoot } from './pathControl'; import { serverRoot, logRoot } from './pathControl';
import { exec } from "./childPromisses"; import { exec } from "./childPromisses";
import { actions, actionConfig } from './globalPlatfroms'; import { actions, actionConfig } from './globalPlatfroms';
@ -12,7 +12,7 @@ export const portListen = /\[.*\]:\s+Starting\s+Minecraft\s+server\s+on\s+(([0-9
export async function installServer(version: string|boolean) { export async function installServer(version: string|boolean) {
if (!fsOld.existsSync(serverPath)) await fs.mkdir(serverPath, {recursive: true}); if (!fsOld.existsSync(serverPath)) await fs.mkdir(serverPath, {recursive: true});
await fs.writeFile(jarPath, await getSpigotJar(version)); await fs.writeFile(jarPath, await platformManeger.spigot.getJar(version));
} }
const serverConfig: actionConfig[] = [ const serverConfig: actionConfig[] = [