// fr.zorycube.launcher.LauncherPanel.onEvent(SwingerEvent): void
// [...]
if(e.getSource() == this.goldPlayButton) {
this.enableButtons(false);
if(this.goldUsernameField.getText().trim().isEmpty()) {
JOptionPane.showMessageDialog(this, "Erreur, veuillez entrer un pseudo et un mot de passe valides.", "Erreur d'Authentification", 0);
this.enableButtons(true);
return;
}
this.saver.set("username", this.goldUsernameField.getText());
//
// Il faut enlever cette ligne:
// this.saver.set("password", this.passwordField.getText());
//
this.saver.save();
this.ramSelector.save();
this.createLauncherThread().start();
}
// [...]
// fr.zorycube.launcher.Launcher.auth(String, String): void
public static void auth(String username, String password) throws AuthenticationException {
Authenticator authenticator = new Authenticator("https://authserver.mojang.com/", AuthPoints.NORMAL_AUTH_POINTS);
AuthResponse response = authenticator.authenticate(AuthAgent.MINECRAFT, username, password, "");
// TODO: Sauvegarder la réponse `response`
// Il faut ensuite vérifier que le jeton est toujours valide:
// https://wiki.vg/Authentication#Validate
//
// S'il n'est plus valide, il faut en regénérer un nouveau à partir de l'ancien:
// https://wiki.vg/Authentication#Refresh
authInfos = new AuthInfos(response.getSelectedProfile().getName(), response.getAccessToken(), response.getSelectedProfile().getId());
}