Update AccountManager.java

This commit is contained in:
kirillsaint 2023-10-21 14:40:59 +06:00
parent bb2ac6b98d
commit 7078bca631

View File

@ -51,11 +51,13 @@ public class AccountManager {
Requests.httpPost(Client.getInstance().getApiUrl() + "/set_selected", new JSONObject().put("selected", index).toString()); Requests.httpPost(Client.getInstance().getApiUrl() + "/set_selected", new JSONObject().put("selected", index).toString());
} }
selected = account; selected = account;
Session session = new Session(account.username, nameToUuid(account.username), account.mc_access_token != null ? account.mc_access_token : "0", account.mc_access_token != null ? "msa" : "legacy"); if(!force) {
((MinecraftExt) Minecraft.getMinecraft()).setSession(session); Session session = new Session(account.username, nameToUuid(account.username), account.mc_access_token != null ? account.mc_access_token : "0", account.mc_access_token != null ? "msa" : "legacy");
Client.getInstance().getUserData().setAccessToken(selected.access_token); ((MinecraftExt) Minecraft.getMinecraft()).setSession(session);
Client.getInstance().getSilentSocket().Disconnect(); Client.getInstance().getUserData().setAccessToken(selected.access_token);
Client.getInstance().getSilentSocket().Connect(selected.access_token); Client.getInstance().getSilentSocket().Disconnect();
Client.getInstance().getSilentSocket().Connect(selected.access_token);
}
PlayerResponse acc = Client.getInstance().updateAccount(); PlayerResponse acc = Client.getInstance().updateAccount();
if(acc != null) { if(acc != null) {
Client.getInstance().setAccount(acc.getAccount()); Client.getInstance().setAccount(acc.getAccount());