SHARE
TWEET

Untitled

a guest Mar 10th, 2019 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package fr.titanium.launcher;
  2.  
  3. import java.io.File;
  4.  
  5. import fr.theshark34.openauth.AuthPoints;
  6. import fr.theshark34.openauth.AuthenticationException;
  7. import fr.theshark34.openauth.Authenticator;
  8. import fr.theshark34.openauth.model.AuthAgent;
  9. import fr.theshark34.openauth.model.response.AuthResponse;
  10. import fr.theshark34.openlauncherlib.launcher.AuthInfos;
  11. import fr.theshark34.openlauncherlib.launcher.GameInfos;
  12. import fr.theshark34.openlauncherlib.launcher.GameTweak;
  13. import fr.theshark34.openlauncherlib.launcher.GameType;
  14. import fr.theshark34.openlauncherlib.launcher.GameVersion;
  15. import fr.theshark34.supdate.BarAPI;
  16. import fr.theshark34.supdate.SUpdate;
  17. import fr.theshark34.swinger.Swinger;
  18.  
  19. public class Launcher {
  20.    
  21.     public static final GameVersion TT_VERSION = new GameVersion("1.7.10", GameType.V1_7_10) ;
  22.     public static final GameInfos TT_INFOS = new GameInfos("Titanium V1", TT_VERSION, true, new GameTweak[] {GameTweak.FORGE}) ;
  23.     public static final File TT_DIR = TT_INFOS.getGameDir() ;
  24.    
  25.     @SuppressWarnings("unused")
  26.     private static AuthInfos authInfos;
  27.     private static Thread updateThread ;
  28.    
  29.     public static void auth(String username, String password) throws AuthenticationException {
  30.        
  31.         Authenticator authenticator = new Authenticator(Authenticator.MOJANG_AUTH_URL, AuthPoints.NORMAL_AUTH_POINTS) ;
  32.        
  33.         AuthResponse response = authenticator.authenticate(AuthAgent.MINECRAFT, username, password, "") ;
  34.        
  35.         authInfos = new AuthInfos(response.getSelectedProfile().getName(), response.getAccessToken(), response.getSelectedProfile().getId()) ;
  36.        
  37.        
  38.        
  39.        
  40.     }
  41.    
  42.     public static void update() throws Exception {
  43.        
  44.         SUpdate su = new SUpdate("http://titanium-launcher.hmsw.eu/", TT_DIR) ;
  45.         updateThread = new Thread() {
  46.            
  47.             Thread t = new Thread() {
  48.            
  49.             private int val ;
  50.             private int max ;
  51.            
  52.             @Override
  53.            
  54.             public void run() {
  55.                
  56.                 while(!this.isInterrupted()) {
  57.                     val = (int) (BarAPI.getNumberOfTotalDownloadedBytes() / 1000) ;
  58.                     max = (int) (BarAPI.getNumberOfTotalBytesToDownload() / 1000) ;
  59.                    
  60.                     LauncherFrame.getInstance().getLauncherPanel().getProgressBar().setMaximum(max);
  61.                     LauncherFrame.getInstance().getLauncherPanel().getProgressBar().setValue(val);
  62.                    
  63.                     LauncherFrame.getInstance().getLauncherPanel().setInfoText("Telechargement Des Fichiers" + BarAPI.getNumberOfDownloadedFiles() + "/" + BarAPI.getNumberOfFileToDownload() + " " + Swinger.percentage(val, max) + "%");
  64.                    
  65.                    
  66.                    
  67.                    
  68.                 }
  69.             }
  70.            
  71.             };
  72.            
  73.            
  74.         };
  75.        
  76.         updateThread.start();
  77.        
  78.         su.start() ;
  79.         updateThread.interrupt();
  80.     }
  81.    
  82.     static void interruptThread() {
  83.         updateThread.interrupt();
  84.        
  85.     }
  86.    
  87.    
  88.  
  89. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top