v1
This commit is contained in:
@@ -7,7 +7,7 @@ const { getMojangOS, isLibraryCompatible, mcVersionAtLeast } = require('helios-
|
||||
const { Type } = require('helios-distribution-types')
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
|
||||
const Custom = require('./custom')
|
||||
const ConfigManager = require('./configmanager')
|
||||
|
||||
const logger = LoggerUtil.getLogger('ProcessBuilder')
|
||||
@@ -70,10 +70,84 @@ class ProcessBuilder {
|
||||
//args = args.concat(this.constructModArguments(modObj.fMods))
|
||||
args = args.concat(this.constructModList(modObj.fMods))
|
||||
}
|
||||
/*const preLaunchArgs = [
|
||||
"-jar",
|
||||
Custom.getCustomConfig().packwizBootstrap,
|
||||
Custom.getCustomConfig().packwizUrl
|
||||
]*/
|
||||
|
||||
logger.info('Launch Arguments:', args)
|
||||
const preLaunchArgsArray = [
|
||||
// "-version"
|
||||
"-jar",
|
||||
//path.join(this.gameDir, "packwiz-installer-bootstrap.jar"),
|
||||
"packwiz-installer-bootstrap.jar",
|
||||
"https://patatapack.oier.ovh/pack/pack.toml"
|
||||
]
|
||||
const preLaunchArgs = [
|
||||
"-jar " +
|
||||
path.join(this.gameDir, "/packwiz-installer-bootstrap.jar") +
|
||||
" https://patatapack.oier.ovh/pack.toml"
|
||||
]
|
||||
|
||||
logger.info('PreLaunch Arguments:', preLaunchArgs)
|
||||
logger.info('getJavaExecutable:', ConfigManager.getJavaExecutable(this.server.rawServer.id))
|
||||
;
|
||||
logger.info('Server RAW id:', this.server.rawServer.id)
|
||||
logger.info('gamedir:', this.gameDir)
|
||||
//const preLaunchChild = child_process.execSync(ConfigManager.getJavaExecutable(this.server.rawServer.id) +" " + preLaunchArgsArray.join(' '), preLaunchArgsArray, {
|
||||
const preLaunchChild = child_process.spawnSync(ConfigManager.getJavaExecutable(this.server.rawServer.id), preLaunchArgsArray, {
|
||||
|
||||
cwd: this.gameDir,
|
||||
// detached: ConfigManager.getLaunchDetached()
|
||||
})
|
||||
const authArgs = [
|
||||
"-Dminecraft.api.env=custom",
|
||||
"-Dminecraft.api.auth.host=https://auth.oier.ovh",
|
||||
"-Dminecraft.api.account.host=https://auth.oier.ovh/user",
|
||||
"-Dminecraft.api.session.host=https://auth.oier.ovh/api/yggdrasil",
|
||||
"-Dminecraft.api.services.host=https://auth.oier.ovh/api/yggdrasil"
|
||||
]
|
||||
args = authArgs.concat(args)
|
||||
|
||||
//preLaunchChild.on('close', (preLaunchCode, preLaunchSignal) => {
|
||||
//logger.info('PRELAUNCH Exited with code', preLaunchCode)
|
||||
logger.info('Launch Arguments:', args)
|
||||
|
||||
const child = child_process.spawn(ConfigManager.getJavaExecutable(this.server.rawServer.id), args, {
|
||||
cwd: this.gameDir,
|
||||
detached: ConfigManager.getLaunchDetached()
|
||||
})
|
||||
|
||||
if(ConfigManager.getLaunchDetached()){
|
||||
child.unref()
|
||||
}
|
||||
|
||||
child.stdout.setEncoding('utf8')
|
||||
child.stderr.setEncoding('utf8')
|
||||
|
||||
child.stdout.on('data', (data) => {
|
||||
data.trim().split('\n').forEach(x => console.log(`\x1b[32m[Minecraft]\x1b[0m ${x}`))
|
||||
|
||||
})
|
||||
child.stderr.on('data', (data) => {
|
||||
data.trim().split('\n').forEach(x => console.log(`\x1b[31m[Minecraft]\x1b[0m ${x}`))
|
||||
})
|
||||
child.on('close', (code, signal) => {
|
||||
logger.info('Exited with code', code)
|
||||
fs.remove(tempNativePath, (err) => {
|
||||
if(err){
|
||||
logger.warn('Error while deleting temp dir', err)
|
||||
} else {
|
||||
logger.info('Temp dir deleted successfully.')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
//return child
|
||||
return child
|
||||
// });
|
||||
|
||||
const child = child_process.spawn(ConfigManager.getJavaExecutable(this.server.rawServer.id), args, {
|
||||
/* const child = child_process.spawn(ConfigManager.getJavaExecutable(this.server.rawServer.id), args, {
|
||||
cwd: this.gameDir,
|
||||
detached: ConfigManager.getLaunchDetached()
|
||||
})
|
||||
@@ -103,7 +177,7 @@ class ProcessBuilder {
|
||||
})
|
||||
})
|
||||
|
||||
return child
|
||||
return child */
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user