Advertisement
TNT_Block

CreateSession

Sep 3rd, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. private Session createSession(String username, String password) {
  2. YggdrasilAuthenticationService service = new YggdrasilAuthenticationService(Proxy.NO_PROXY, "");
  3. YggdrasilUserAuthentication auth = (YggdrasilUserAuthentication) service
  4. .createUserAuthentication(Agent.MINECRAFT);
  5. auth.setUsername(username);
  6. auth.setPassword(password);
  7. try {
  8. auth.logIn();
  9. return new Session(auth.getSelectedProfile().getName(), auth.getSelectedProfile().getId().toString(),
  10. auth.getAuthenticatedToken(), "mojang");
  11. } catch (AuthenticationException localAuthenticationException) {
  12. localAuthenticationException.printStackTrace();
  13. return null;
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement