Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.marcigamer.legitclient.ui;
- import java.net.Proxy;
- import com.mojang.authlib.Agent;
- import com.mojang.authlib.exceptions.AuthenticationException;
- import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
- import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication;
- import net.minecraft.client.Minecraft;
- import net.minecraft.util.Session;
- public class AltThread extends Thread {
- protected final Minecraft mc = Minecraft.getMinecraft();
- protected final String password;
- protected String status;
- protected final String username;
- public AltThread(String username, String password) {
- super("Alt Thread");
- this.username = username;
- this.password = password;
- this.status = "§7Waiting...";
- }
- public void setStatus(String status) {
- this.status = status;
- }
- public String getStatus() {
- return this.status;
- }
- protected 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 final String checkAndAddAlt(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 (status = "§aAlt added. (" + username + ")");
- } catch (AuthenticationException e) {
- e.printStackTrace();
- return (status = "§cAlt failed! (" + username + ")");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement