mirror of
https://github.com/ViaVersion/ViaProxy.git
synced 2024-11-04 09:10:36 +01:00
Fixed account selection being reset (or not reset) sometimes
This commit is contained in:
parent
4a78b4becb
commit
8d10f9956d
@ -17,8 +17,8 @@ public class ViaProxyUI extends JFrame {
|
||||
|
||||
private final JTabbedPane contentPane = new JTabbedPane();
|
||||
private final List<AUITab> tabs = new ArrayList<>();
|
||||
private final GeneralTab generalTab = new GeneralTab(this);
|
||||
private final AccountsTab accountsTab = new AccountsTab(this);
|
||||
public final GeneralTab generalTab = new GeneralTab(this);
|
||||
public final AccountsTab accountsTab = new AccountsTab(this);
|
||||
|
||||
private ImageIcon icon;
|
||||
|
||||
|
@ -9,7 +9,10 @@ import net.raphimc.viaproxy.ui.ViaProxyUI;
|
||||
import net.raphimc.viaproxy.ui.popups.AddAccountPopup;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
public class AccountsTab extends AUITab {
|
||||
@ -213,8 +216,8 @@ public class AccountsTab extends AUITab {
|
||||
else model.addElement(account.name() + " (Microsoft)");
|
||||
}
|
||||
|
||||
private void markSelected(final int index) {
|
||||
if (index == -1) {
|
||||
public void markSelected(final int index) {
|
||||
if (index < 0 || index >= this.accountsList.getModel().getSize()) {
|
||||
Options.MC_ACCOUNT = null;
|
||||
return;
|
||||
}
|
||||
|
@ -166,7 +166,15 @@ public class GeneralTab extends AUITab {
|
||||
Options.PROTOCOL_VERSION = serverVersion;
|
||||
Options.BETACRAFT_AUTH = betaCraftAuth;
|
||||
|
||||
if (authMethod == 2) Options.OPENAUTHMOD_AUTH = true;
|
||||
if (authMethod != 1) {
|
||||
Options.MC_ACCOUNT = null;
|
||||
} else if (Options.MC_ACCOUNT == null) {
|
||||
this.frame.accountsTab.markSelected(0);
|
||||
}
|
||||
|
||||
if (authMethod == 2) {
|
||||
Options.OPENAUTHMOD_AUTH = true;
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
this.frame.showError("Invalid server address!");
|
||||
|
Loading…
Reference in New Issue
Block a user