dmclc
Version:
Dolphin Minecraft Launcher Core
31 lines (30 loc) • 1.17 kB
JavaScript
import fs from "fs";
import { download } from "../utils/downloads.js";
import { YggdrasilAccount } from "./yggdrasil/yggdrasil_account.js";
import { YggdrasilUserData } from "./yggdrasil/yggdrasil_data.js";
export class MinecraftUniversalLoginUserData extends YggdrasilUserData {
serverID;
}
export class MinecraftUniversalLoginAccount extends YggdrasilAccount {
constructor(data, launcher) {
super(data, launcher);
}
async login() {
this.data.serverID = await this.launcher.askUserOne("accounts.minecraft_universal_login.serverID");
this.data.apiurl = "https://auth.mc-user.com:233/" + this.data.serverID;
return await super.login();
}
async prepareLaunch(versionDir) {
const path = `${versionDir}/nide8auth.jar`;
if (!fs.existsSync(path)) {
return await download("https://login.mc-user.com:233/index/jar", path, this.launcher);
}
return true;
}
async getLaunchJVMArgs() {
return [`-javaagent:./nide8auth.jar=${this.data.serverID}`, "-Dnide8auth.client=true"];
}
toString() {
return `${this.data.name} (${this.data.serverName})`;
}
}