Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Session createSession(String username, String password) {
- YggdrasilAuthenticationService service = new YggdrasilAuthenticationService(Proxy.NO_PROXY, "");
- YggdrasilUserAuthentication auth = (YggdrasilUserAuthentication) service
- .createUserAuthentication(Agent.MINECRAFT);
- auth.setUsername(username);
- auth.setPassword(password);
- try {
- auth.logIn();
- return new Session(auth.getSelectedProfile().getName(), auth.getSelectedProfile().getId().toString(),
- auth.getAuthenticatedToken(), "mojang");
- } catch (AuthenticationException localAuthenticationException) {
- localAuthenticationException.printStackTrace();
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement