Sirherobrine23 dev #133

Merged
Sirherobrine23 merged 5 commits from Sirherobrine23_Dev into main 2021-07-18 03:09:55 +00:00
2 changed files with 15 additions and 7 deletions
Showing only changes of commit 7dd872e211 - Show all commits

View File

@ -43,7 +43,9 @@ module.exports = function (version, force_install, callback) {
if (existsSync(join(bds_dir_bedrock, "server.properties"))) server_configs = readFileSync(join(bds_dir_bedrock, "server.properties"), "utf8"); if (existsSync(join(bds_dir_bedrock, "server.properties"))) server_configs = readFileSync(join(bds_dir_bedrock, "server.properties"), "utf8");
if (existsSync(join(bds_dir_bedrock, "permissions.json"))) permissions = readFileSync(join(bds_dir_bedrock, "permissions.json"), "utf8"); if (existsSync(join(bds_dir_bedrock, "permissions.json"))) permissions = readFileSync(join(bds_dir_bedrock, "permissions.json"), "utf8");
if (existsSync(join(bds_dir_bedrock, "whitelist.json"))) whitelist = readFileSync(join(bds_dir_bedrock, "whitelist.json"), "utf8"); if (existsSync(join(bds_dir_bedrock, "whitelist.json"))) whitelist = readFileSync(join(bds_dir_bedrock, "whitelist.json"), "utf8");
fetchSync(url, {}, true).Buffer; fetchSync(url, {
Binary: true
}).Buffer;
console.log("Download Sucess") console.log("Download Sucess")
const zip = new AdmZip(response) const zip = new AdmZip(response)
zip.extractAllTo(bds_dir_bedrock, true) zip.extractAllTo(bds_dir_bedrock, true)
@ -68,7 +70,9 @@ module.exports = function (version, force_install, callback) {
} else { } else {
url = Servers.java[version].url url = Servers.java[version].url
console.log(`Server data publish: ${Servers.java[version].data}`) console.log(`Server data publish: ${Servers.java[version].data}`)
response = fetchSync(url, {}, true).Buffer response = fetchSync(url, {
Binary: true
}).Buffer
console.log("Download Sucess") console.log("Download Sucess")
writeFileSync(join(bds_dir_java, "MinecraftServerJava.jar"), response, "binary") writeFileSync(join(bds_dir_java, "MinecraftServerJava.jar"), response, "binary")
console.log("Save sucess"); console.log("Save sucess");
@ -89,7 +93,9 @@ module.exports = function (version, force_install, callback) {
} else { } else {
const PocketMineJson = Servers.pocketmine[version] const PocketMineJson = Servers.pocketmine[version]
console.log(`Server data publish: ${PocketMineJson.data}`); console.log(`Server data publish: ${PocketMineJson.data}`);
response = fetchSync(PocketMineJson.url, {}, true).Buffer; response = fetchSync(PocketMineJson.url, {
Binary: true
}).Buffer;
console.log("Success when downloading php from PocketMine-MP"); console.log("Success when downloading php from PocketMine-MP");
// Write php file // Write php file
writeFileSync(join(bds_dir_pocketmine, "PocketMine-MP.phar"), response, "binary") writeFileSync(join(bds_dir_pocketmine, "PocketMine-MP.phar"), response, "binary")
@ -98,7 +104,9 @@ module.exports = function (version, force_install, callback) {
var urlPHPBin; /* Check System php */try {urlPHPBin = PHPBin[process.platform][bds.arch]} catch (error) {throw new Error("unsupported system")} var urlPHPBin; /* Check System php */try {urlPHPBin = PHPBin[process.platform][bds.arch]} catch (error) {throw new Error("unsupported system")}
console.log("Downloading PHP Binaries"); console.log("Downloading PHP Binaries");
// Fetch Files // Fetch Files
const php = fetchSync(urlPHPBin, {}, true); const php = fetchSync(urlPHPBin, {
Binary: true
});
const zipExtractBin = new AdmZip(php); const zipExtractBin = new AdmZip(php);
// Extract bin // Extract bin
zipExtractBin.extractAllTo(bds_dir_pocketmine, true) zipExtractBin.extractAllTo(bds_dir_pocketmine, true)