mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2025-02-23 20:51:30 +03:00
Change how authentication gets passed
I was making a launcher of my own, and I found it very hard to juggle with having the auth in the options since I needed to set the client events before I actaully had the users login. This will fix the issue i was running into!
This commit is contained in:
parent
69ec61f56e
commit
3f0ceae5b6
3 changed files with 16 additions and 5 deletions
|
@ -14,7 +14,15 @@ class MCLCore extends EventEmitter {
|
|||
this.pid = null;
|
||||
}
|
||||
|
||||
async launch() {
|
||||
async launch(authorization) {
|
||||
if(!authorization) throw Error('No authorization to launch the client with!');
|
||||
|
||||
if({}.toString.call(authorization) === "[object Promise]") {
|
||||
this.options.authorization = await authorization;
|
||||
} else {
|
||||
this.options.authorization = authorization
|
||||
}
|
||||
|
||||
this.options.root = path.resolve(this.options.root);
|
||||
if(!fs.existsSync(this.options.root)) {
|
||||
this.emit('debug', '[MCLC]: Attempting to create root folder');
|
||||
|
|
Loading…
Add table
Reference in a new issue