Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mc.sebakagrief.ru.util;
- import com.mojang.authlib.Agent;
- import com.mojang.authlib.GameProfile;
- import com.mojang.authlib.exceptions.AuthenticationException;
- import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
- import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication;
- import java.net.Proxy;
- import java.util.UUID;
- import net.minecraft.client.Minecraft;
- import net.minecraft.util.Session;
- public class AltThread extends Thread {
- private final Minecraft mc = Minecraft.getMinecraft();
- private final String password;
- private final String username;
- public AltThread(String username, String password) {
- super("Alt Login Thread");
- this.username = username;
- this.password = password;
- }
- private final 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 e) {
- }
- return null;
- }
- public void run() {
- if (this.password.equals("")) {
- this.mc.session = new Session(this.username, mc.session.getPlayerID(), mc.session.getSessionID(), "mojang");
- return;
- }
- Session auth = createSession(this.username, this.password);
- if (auth == null) {
- } else {
- this.mc.session = auth;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement