mirror of
https://github.com/ViaVersion/ViaProxy.git
synced 2024-09-07 01:08:06 +02:00
Fixed bedrock accounts not saving
This commit is contained in:
parent
7448c0cbff
commit
5a3ea47e8d
@ -20,12 +20,10 @@ package net.raphimc.viaproxy.saves.impl;
|
|||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import net.raphimc.mcauth.step.bedrock.StepMCChain;
|
|
||||||
import net.raphimc.mcauth.step.java.StepMCProfile;
|
import net.raphimc.mcauth.step.java.StepMCProfile;
|
||||||
import net.raphimc.mcauth.util.MicrosoftConstants;
|
import net.raphimc.mcauth.util.MicrosoftConstants;
|
||||||
import net.raphimc.viaproxy.saves.AbstractSave;
|
import net.raphimc.viaproxy.saves.AbstractSave;
|
||||||
import net.raphimc.viaproxy.saves.impl.accounts.Account;
|
import net.raphimc.viaproxy.saves.impl.accounts.Account;
|
||||||
import net.raphimc.viaproxy.saves.impl.accounts.BedrockAccount;
|
|
||||||
import net.raphimc.viaproxy.saves.impl.accounts.MicrosoftAccount;
|
import net.raphimc.viaproxy.saves.impl.accounts.MicrosoftAccount;
|
||||||
import net.raphimc.viaproxy.saves.impl.accounts.OfflineAccount;
|
import net.raphimc.viaproxy.saves.impl.accounts.OfflineAccount;
|
||||||
import net.raphimc.viaproxy.util.logging.Logger;
|
import net.raphimc.viaproxy.util.logging.Logger;
|
||||||
@ -76,14 +74,13 @@ public class NewAccountsSave extends AbstractSave {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Account addAccount(final StepMCChain.MCChain mcChain) {
|
public Account addAccount(final String username) {
|
||||||
final Account account = new BedrockAccount(mcChain);
|
final Account account = new OfflineAccount(username);
|
||||||
this.accounts.add(account);
|
this.accounts.add(account);
|
||||||
return account;
|
return account;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Account addAccount(final String username) {
|
public Account addAccount(final Account account) {
|
||||||
final Account account = new OfflineAccount(username);
|
|
||||||
this.accounts.add(account);
|
this.accounts.add(account);
|
||||||
return account;
|
return account;
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,9 @@ public class BedrockAccount extends Account {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BedrockAccount(final StepMCChain.MCChain mcChain) {
|
public BedrockAccount(final StepMCChain.MCChain mcChain, final StepPlayFabToken.PlayFabToken playFabToken) {
|
||||||
this.mcChain = mcChain;
|
this.mcChain = mcChain;
|
||||||
|
this.playFabToken = playFabToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -18,11 +18,14 @@
|
|||||||
package net.raphimc.viaproxy.ui.impl;
|
package net.raphimc.viaproxy.ui.impl;
|
||||||
|
|
||||||
import net.raphimc.mcauth.MinecraftAuth;
|
import net.raphimc.mcauth.MinecraftAuth;
|
||||||
|
import net.raphimc.mcauth.step.bedrock.StepMCChain;
|
||||||
|
import net.raphimc.mcauth.step.bedrock.playfab.StepPlayFabToken;
|
||||||
import net.raphimc.mcauth.step.msa.StepMsaDeviceCode;
|
import net.raphimc.mcauth.step.msa.StepMsaDeviceCode;
|
||||||
import net.raphimc.mcauth.util.MicrosoftConstants;
|
import net.raphimc.mcauth.util.MicrosoftConstants;
|
||||||
import net.raphimc.viaproxy.ViaProxy;
|
import net.raphimc.viaproxy.ViaProxy;
|
||||||
import net.raphimc.viaproxy.cli.options.Options;
|
import net.raphimc.viaproxy.cli.options.Options;
|
||||||
import net.raphimc.viaproxy.saves.impl.accounts.Account;
|
import net.raphimc.viaproxy.saves.impl.accounts.Account;
|
||||||
|
import net.raphimc.viaproxy.saves.impl.accounts.BedrockAccount;
|
||||||
import net.raphimc.viaproxy.ui.AUITab;
|
import net.raphimc.viaproxy.ui.AUITab;
|
||||||
import net.raphimc.viaproxy.ui.ViaProxyUI;
|
import net.raphimc.viaproxy.ui.ViaProxyUI;
|
||||||
import net.raphimc.viaproxy.ui.popups.AddAccountPopup;
|
import net.raphimc.viaproxy.ui.popups.AddAccountPopup;
|
||||||
@ -207,9 +210,12 @@ public class AccountsTab extends AUITab {
|
|||||||
this.addBedrockAccountButton.setEnabled(false);
|
this.addBedrockAccountButton.setEnabled(false);
|
||||||
this.handleLogin(msaDeviceCodeConsumer -> {
|
this.handleLogin(msaDeviceCodeConsumer -> {
|
||||||
try (final CloseableHttpClient httpClient = MicrosoftConstants.createHttpClient()) {
|
try (final CloseableHttpClient httpClient = MicrosoftConstants.createHttpClient()) {
|
||||||
return MinecraftAuth.BEDROCK_DEVICE_CODE_LOGIN.getFromInput(httpClient, new StepMsaDeviceCode.MsaDeviceCodeCallback(msaDeviceCodeConsumer));
|
final StepMCChain.MCChain mcChain = MinecraftAuth.BEDROCK_DEVICE_CODE_LOGIN.getFromInput(httpClient, new StepMsaDeviceCode.MsaDeviceCodeCallback(msaDeviceCodeConsumer));
|
||||||
|
final StepPlayFabToken.PlayFabToken playFabToken = MinecraftAuth.BEDROCK_PLAY_FAB_TOKEN.getFromInput(httpClient, mcChain.prevResult().fullXblSession());
|
||||||
|
|
||||||
|
return new BedrockAccount(mcChain, playFabToken);
|
||||||
}
|
}
|
||||||
}, chain -> ViaProxy.saveManager.accountsSave.addAccount(chain));
|
}, account -> ViaProxy.saveManager.accountsSave.addAccount(account));
|
||||||
});
|
});
|
||||||
addButtons.add(this.addBedrockAccountButton);
|
addButtons.add(this.addBedrockAccountButton);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user