Incase package.json is removed, skip over version check.

This commit is contained in:
Pierce 2020-03-24 14:52:30 -04:00
parent cc9396a851
commit 4e9c2fbfb3
3 changed files with 5 additions and 3 deletions

View file

@ -28,7 +28,9 @@ class MCLCore extends EventEmitter {
// Lets the events register. our magic switch!
await void(0);
this.emit('debug', `[MCLC]: MCLC version ${JSON.parse(fs.readFileSync(path.join(__dirname,'..', 'package.json'), { encoding: 'utf8' })).version}`);
if(fs.existsSync(path.join(__dirname,'..', 'package.json'))) {
this.emit('debug', `[MCLC]: MCLC version ${JSON.parse(fs.readFileSync(path.join(__dirname,'..', 'package.json'), { encoding: 'utf8' })).version}`);
} else { this.emit('debug', `[MCLC]: Package JSON not found, skipping MCLC version check.`); }
const java = await this.handler.checkJava(this.options.javaPath || 'java');
if(!java.run) {
this.emit('debug', `[MCLC]: Couldn't start Minecraft due to: ${java.message}`);