Advertisement
Guest User

Untitled

a guest
Nov 18th, 2018
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.44 KB | None | 0 0
  1. package fr.nathanael2611.projectz.launcher;
  2.  
  3.  
  4. import fr.theshark34.openauth.AuthPoints;
  5. import fr.theshark34.openauth.AuthenticationException;
  6. import fr.theshark34.openauth.Authenticator;
  7. import fr.theshark34.openauth.model.AuthAgent;
  8. import fr.theshark34.openauth.model.response.AuthResponse;
  9. import fr.theshark34.openlauncherlib.LaunchException;
  10. import fr.theshark34.openlauncherlib.external.ExternalLaunchProfile;
  11. import fr.theshark34.openlauncherlib.external.ExternalLauncher;
  12. import fr.theshark34.openlauncherlib.minecraft.*;
  13. import fr.theshark34.supdate.BarAPI;
  14. import fr.theshark34.supdate.SUpdate;
  15. import fr.theshark34.supdate.application.integrated.FileDeleter;
  16.  
  17. import javax.swing.*;
  18. import java.io.File;
  19. import java.util.Arrays;
  20.  
  21. public class Launcher {
  22.  
  23. public static final GameVersion PZ_VERSION = new GameVersion("1.7.10", GameType.V1_7_10);
  24. public static final GameInfos PZ_INFOS = new GameInfos("ProjectZ", PZ_VERSION, new GameTweak[] {GameTweak.FORGE});
  25. public static final File PZ_DIR = PZ_INFOS.getGameDir();
  26. public static boolean IS_CRACK = false;
  27.  
  28.  
  29.  
  30. private static AuthInfos authInfos;
  31. private static Thread updateThread;
  32.  
  33.  
  34. public JLabel dlLabel = new JLabel("", SwingConstants.CENTER);
  35.  
  36.  
  37.  
  38.  
  39.  
  40. public static void auth(String username, String password) throws AuthenticationException {
  41.  
  42.  
  43. if(IS_CRACK == false) {
  44.  
  45. Authenticator authenticator = new Authenticator(Authenticator.MOJANG_AUTH_URL, AuthPoints.NORMAL_AUTH_POINTS);
  46. AuthResponse response = authenticator.authenticate(AuthAgent.MINECRAFT, username, password, "");
  47. authInfos = new AuthInfos(response.getSelectedProfile().getName(), response.getAccessToken(), response.getSelectedProfile().getId());
  48. }else{
  49. authInfos = new AuthInfos(username, "sry", "nope");
  50. }
  51.  
  52.  
  53.  
  54.  
  55.  
  56. }
  57.  
  58.  
  59.  
  60.  
  61.  
  62. public static void update() throws Exception {
  63.  
  64. SUpdate su = new SUpdate("http://kyrgon.revhost.fr/kyrgon.revhost.fr/launcher/BloodyGaming/su-launcher", PZ_DIR);
  65. su.addApplication(new FileDeleter());
  66.  
  67. updateThread = new Thread()
  68. {
  69. private int val;
  70. private int max;
  71.  
  72. public void run()
  73. {
  74. while (!isInterrupted())
  75. {
  76. this.val = ((int)(BarAPI.getNumberOfTotalDownloadedBytes() / 1000L));
  77. this.max = ((int)(BarAPI.getNumberOfTotalBytesToDownload() / 1000L));
  78.  
  79. LauncherFrame.getInstance().getLauncherPanel().getProgressBar().setValue(this.val);
  80. LauncherFrame.getInstance().getLauncherPanel().getProgressBar().setMaximum(this.max);
  81. }
  82. }
  83. };
  84. updateThread.start();
  85. su.start();
  86. updateThread.interrupt();
  87. }
  88.  
  89.  
  90.  
  91.  
  92.  
  93. public static void launch() throws LaunchException {
  94. ExternalLaunchProfile profile = MinecraftLauncher.createExternalProfile(PZ_INFOS, GameFolder.BASIC, authInfos);
  95. profile.getVmArgs().addAll(Arrays.asList(LauncherFrame.getInstance().getLauncherPanel().getRamSelector().getRamArguments()));
  96. ExternalLauncher launcher = new ExternalLauncher(profile);
  97. Process p = launcher.launch();
  98. LauncherFrame.getInstance().setVisible(false);
  99. System.exit(0);
  100. }
  101.  
  102.  
  103. public static void InterruptThread() {
  104.  
  105. updateThread.interrupt();
  106.  
  107. }
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement