Litarvan / OpenAuth

Java Yggdrasil library.
GNU General Public License v3.0
162 stars 30 forks source link

Problème de token #6

Closed Tk77185 closed 5 years ago

Tk77185 commented 5 years ago

Bonjour quand je lance le launcher, je me login et le launcher fait ses màj et au moment de lancer le jeu, il ne lance pas et fait ceci : [OpenLauncherLib] Lancement de net.minecraft.client.main.Main joptsimple.MissingRequiredOptionException: Missing required option(s) ['accessToken'] Exception in thread "main" at joptsimple.OptionParser.ensureRequiredOptions(OptionParser.java:375) at joptsimple.OptionParser.parse(OptionParser.java:365) at net.minecraft.client.main.Main.main(SourceFile:51)

https://pastebin.com/SkvtEzaS

Une solution ? merci

Litarvan commented 5 years ago

Il me faut le code de Launcher.java

Tk77185 commented 5 years ago

package fr.cubedev.atlaris;

import java.io.File; import java.io.IOException;

import fr.litarvan.openauth.AuthPoints; import fr.litarvan.openauth.AuthenticationException; import fr.litarvan.openauth.Authenticator; import fr.litarvan.openauth.model.AuthAgent; import fr.litarvan.openauth.model.response.AuthResponse; import fr.theshark34.openlauncherlib.LaunchException; import fr.theshark34.openlauncherlib.external.ExternalLaunchProfile; import fr.theshark34.openlauncherlib.external.ExternalLauncher; import fr.theshark34.openlauncherlib.minecraft.AuthInfos; import fr.theshark34.openlauncherlib.minecraft.GameFolder; import fr.theshark34.openlauncherlib.minecraft.GameInfos; import fr.theshark34.openlauncherlib.minecraft.GameTweak; import fr.theshark34.openlauncherlib.minecraft.GameType; import fr.theshark34.openlauncherlib.minecraft.GameVersion; import fr.theshark34.openlauncherlib.minecraft.MinecraftLauncher; import fr.theshark34.openlauncherlib.util.ProcessLogManager; import fr.theshark34.supdate.BarAPI; import fr.theshark34.supdate.SUpdate; import fr.theshark34.supdate.application.integrated.FileDeleter; import fr.theshark34.swinger.Swinger;

public class Launcher {

public static final GameVersion ATARIS_VERSION = new GameVersion("1.8", GameType.V1_8_HIGHER);
public static final GameInfos ATARIS_INFOS = new GameInfos("Ataris", ATARIS_VERSION, new GameTweak[]{});
public static final File ATARIS_DIR = ATARIS_INFOS.getGameDir();
public static final File ATARIS_CRASH_FOLDER = new File(ATARIS_DIR, "crashes");

private static AuthInfos authInfos = new AuthInfos("PlayerUsername", "token", "uuid");
private static Thread updateThread;

public static void auth(String username, String password) throws AuthenticationException {

    Authenticator authenticator = new Authenticator(Authenticator.MOJANG_AUTH_URL, AuthPoints.NORMAL_AUTH_POINTS);
    AuthResponse rep = authenticator.authenticate(AuthAgent.MINECRAFT, username, password, "");
    authInfos = new AuthInfos(rep.getSelectedProfile().getName(), rep.getAccessToken(), rep.getSelectedProfile().getId());

}

public static void update() throws Exception {
    SUpdate su = new SUpdate("http://launcher.onexius.com/", ATARIS_DIR);
    su.addApplication(new FileDeleter());

     updateThread = new Thread() {          
    private int val;
    private int max;

    @Override
    public void run() {
     while(!this.isInterrupted()) {
        if(BarAPI.getNumberOfFileToDownload() == 0 ) {
            LauncherFrame.getInstance().getLauncherPanel().setInfoText("Vérification des fichiers");
                continue;
            }
    val = (int) (BarAPI.getNumberOfTotalDownloadedBytes() / 1000);
    max = (int) (BarAPI.getNumberOfTotalBytesToDownload() / 1000);

    LauncherFrame.getInstance().getLauncherPanel().getProgressBar().setMaximum(max);
    LauncherFrame.getInstance().getLauncherPanel().getProgressBar().setValue(val);

    LauncherFrame.getInstance().getLauncherPanel().setInfoText("Telechargement en cours " + 
                 BarAPI.getNumberOfDownloadedFiles() + "/" + BarAPI.getNumberOfFileToDownload() + " " +
                    Swinger.percentage(val, max) + "%");
           }
       }
    };
    updateThread.start();

    su.start();
    updateThread.interrupt();
}
public static void launch() throws IOException, LaunchException {
  try
     {
     AuthInfos authInfos = new AuthInfos("", "", "");
     ExternalLaunchProfile profile = MinecraftLauncher.createExternalProfile(Launcher.ATARIS_INFOS, GameFolder.BASIC, authInfos);
     ExternalLauncher launcher = new ExternalLauncher(profile);

     Process p = launcher.launch(); 
     ProcessLogManager manager = new ProcessLogManager(p.getInputStream(), new File(ATARIS_DIR, "logs.txt"));
     manager.start();   

    Thread.sleep(5000L);
    LauncherFrame.getInstance().setVisible(false);
    p.waitFor();
     }
     catch (InterruptedException e)
     {
         e.printStackTrace();
     }
      System.exit(0);
    }

public static void interruptThread() {
    {   
        updateThread.interrupt();
    }
}

}

Litarvan commented 5 years ago

Si tu es en premium, enlève cette ligne : AuthInfos authInfos = new AuthInfos("", "", ""); ça ne sert à rien à part te créer l'erreur. En revanche si tu es en crack, laisse là mais remplace là par AuthInfos authInfos = new AuthInfos("sry", "nope", UUID.randomUUID().toString());

Tk77185 commented 5 years ago

Merci cela fonctionne