Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.nathanael2611.projectz.launcher;
- import fr.theshark34.openauth.AuthPoints;
- import fr.theshark34.openauth.AuthenticationException;
- import fr.theshark34.openauth.Authenticator;
- import fr.theshark34.openauth.model.AuthAgent;
- import fr.theshark34.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.*;
- import fr.theshark34.supdate.BarAPI;
- import fr.theshark34.supdate.SUpdate;
- import fr.theshark34.supdate.application.integrated.FileDeleter;
- import javax.swing.*;
- import java.io.File;
- import java.util.Arrays;
- public class Launcher {
- public static final GameVersion PZ_VERSION = new GameVersion("1.7.10", GameType.V1_7_10);
- public static final GameInfos PZ_INFOS = new GameInfos("ProjectZ", PZ_VERSION, new GameTweak[] {GameTweak.FORGE});
- public static final File PZ_DIR = PZ_INFOS.getGameDir();
- public static boolean IS_CRACK = false;
- private static AuthInfos authInfos;
- private static Thread updateThread;
- public JLabel dlLabel = new JLabel("", SwingConstants.CENTER);
- public static void auth(String username, String password) throws AuthenticationException {
- if(IS_CRACK == false) {
- Authenticator authenticator = new Authenticator(Authenticator.MOJANG_AUTH_URL, AuthPoints.NORMAL_AUTH_POINTS);
- AuthResponse response = authenticator.authenticate(AuthAgent.MINECRAFT, username, password, "");
- authInfos = new AuthInfos(response.getSelectedProfile().getName(), response.getAccessToken(), response.getSelectedProfile().getId());
- }else{
- authInfos = new AuthInfos(username, "sry", "nope");
- }
- }
- public static void update() throws Exception {
- SUpdate su = new SUpdate("http://kyrgon.revhost.fr/kyrgon.revhost.fr/launcher/BloodyGaming/su-launcher", PZ_DIR);
- su.addApplication(new FileDeleter());
- updateThread = new Thread()
- {
- private int val;
- private int max;
- public void run()
- {
- while (!isInterrupted())
- {
- this.val = ((int)(BarAPI.getNumberOfTotalDownloadedBytes() / 1000L));
- this.max = ((int)(BarAPI.getNumberOfTotalBytesToDownload() / 1000L));
- LauncherFrame.getInstance().getLauncherPanel().getProgressBar().setValue(this.val);
- LauncherFrame.getInstance().getLauncherPanel().getProgressBar().setMaximum(this.max);
- }
- }
- };
- updateThread.start();
- su.start();
- updateThread.interrupt();
- }
- public static void launch() throws LaunchException {
- ExternalLaunchProfile profile = MinecraftLauncher.createExternalProfile(PZ_INFOS, GameFolder.BASIC, authInfos);
- profile.getVmArgs().addAll(Arrays.asList(LauncherFrame.getInstance().getLauncherPanel().getRamSelector().getRamArguments()));
- ExternalLauncher launcher = new ExternalLauncher(profile);
- Process p = launcher.launch();
- LauncherFrame.getInstance().setVisible(false);
- System.exit(0);
- }
- public static void InterruptThread() {
- updateThread.interrupt();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement