use of net.technicpack.launchercore.exception.AuthenticationNetworkFailureException in project LauncherV3 by TechnicPack.
the class LoginFrame method verifyExistingLogin.
private void verifyExistingLogin(MojangUser mojangUser) {
MojangUser loginMojangUser = mojangUser;
boolean rejected = false;
try {
UserModel.AuthError error = userModel.attemptUserRefresh(mojangUser);
if (error != null) {
JOptionPane.showMessageDialog(this, error.getErrorDescription(), error.getError(), JOptionPane.ERROR_MESSAGE);
loginMojangUser = null;
rejected = true;
}
} catch (AuthenticationNetworkFailureException ex) {
Utils.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
// is actually at the login UI clicking the login button), give them a choice.
if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(this, "The auth servers at Minecraft.net are inaccessible. Would you like to play offline?", "Offline Play", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE)) {
// This is the last time we'll have access to the user's real username, so we should set the last-used
// username now
userModel.setLastUser(mojangUser);
// Create offline user
loginMojangUser = new MojangUser(mojangUser.getDisplayName());
} else {
// Use clicked 'no', so just pull the ripcord and get back to the UI
loginMojangUser = null;
}
}
if (loginMojangUser == null) {
// and refresh the user list
if (rejected) {
userModel.removeUser(mojangUser);
refreshUsers();
setCurrentUser(mojangUser.getUsername());
}
}
}
Aggregations