use of games.strategy.net.IMessenger in project triplea by triplea-game.
the class LobbyLogin method login.
@Nullable
private LobbyClient login(final LoginPanel panel) {
try {
final IMessenger messenger = GameRunner.newBackgroundTaskRunner().runInBackgroundAndReturn("Connecting to lobby...", () -> login(panel.getUserName(), panel.getPassword(), panel.isAnonymousLogin()), IOException.class);
panel.getLobbyLoginPreferences().save();
return new LobbyClient(messenger, panel.isAnonymousLogin());
} catch (final CouldNotLogInException e) {
showError("Login Failed", e.getMessage() + "\n" + playerMacIdString());
// NB: potential stack overflow due to recursive call
return loginToServer();
} catch (final IOException e) {
showError("Could Not Connect", "Could not connect to lobby: " + e.getMessage());
return null;
} catch (final InterruptedException e) {
Thread.currentThread().interrupt();
return null;
}
}
use of games.strategy.net.IMessenger in project triplea by triplea-game.
the class LobbyLogin method createAccount.
@Nullable
private LobbyClient createAccount(final CreateUpdateAccountPanel panel) {
try {
final IMessenger messenger = GameRunner.newBackgroundTaskRunner().runInBackgroundAndReturn("Connecting to lobby...", () -> createAccount(panel.getUserName(), panel.getPassword(), panel.getEmail()), IOException.class);
panel.getLobbyLoginPreferences().save();
return new LobbyClient(messenger, false);
} catch (final CouldNotLogInException e) {
showError("Account Creation Failed", e.getMessage());
// NB: potential stack overflow due to recursive call
return createAccount();
} catch (final IOException e) {
showError("Could Not Connect", "Could not connect to lobby: " + e.getMessage());
return null;
} catch (final InterruptedException e) {
Thread.currentThread().interrupt();
return null;
}
}
Aggregations