Advertisement
Corosus

Untitled

Feb 13th, 2012
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. //go to Minecraft.java, in the run() function, put this code after the first try catch:
  2. session = new Session("Username", getSession("Username", "password"));
  3.  
  4. //put this in Minecraft.java
  5. public String getSession(String user, String pass) {
  6. String userName = user;
  7. String password = pass;
  8. String result = null;
  9. try {
  10. String parameters = (new StringBuilder("user=")).append(URLEncoder.encode(userName, "UTF-8")).append("&password=").append(URLEncoder.encode(password, "UTF-8")).append("&version=").append(12).toString();
  11. result = Util.excutePost("https://login.minecraft.net/", parameters);
  12. } catch(Exception e) {
  13. e.printStackTrace();
  14. }
  15. if(result == null) {
  16. return "";
  17. }
  18.  
  19. if(!result.contains(":")) {
  20. if(result.trim().equals("Bad login")) {
  21. //showError("Login failed");
  22. } else if(result.trim().equals("Old version")) {
  23. //loginForm.setOutdated();
  24. //showError("Outdated launcher");
  25. } else {
  26. //showError(result);
  27. }
  28.  
  29. //loginForm.setNoNetwork();
  30. return "";
  31. }
  32.  
  33. String values[] = result.split(":");
  34. return values[3].trim();
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement