Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.lordethan.cryton.utils;
- import com.mojang.authlib.Agent;
- import com.mojang.authlib.GameProfile;
- import com.mojang.authlib.UserAuthentication;
- import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
- import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication;
- import java.net.Proxy;
- import java.util.UUID;
- import me.lordethan.cryton.utils.ChatColor;
- import net.minecraft.client.Minecraft;
- import net.minecraft.util.Session;
- public class LoginThread
- extends Thread {
- private final Minecraft mc = Minecraft.getMinecraft();
- private String status;
- private final String username;
- private final String password;
- public LoginThread(String username, String password) {
- super("Login Thread");
- this.username = username;
- this.password = password;
- this.status = "Current Account :" + this.username;
- }
- 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 (Exception e) {
- return null;
- }
- }
- public String getStatus() {
- return this.status;
- }
- @Override
- public void run() {
- if (this.password.equals("")) {
- this.mc.session = new Session(this.username, "", "", "mojang");
- this.status = (Object)((Object)ChatColor.GREEN) + "Logged in. " + this.username + " - cracked";
- return;
- }
- this.status = (Object)((Object)ChatColor.YELLOW) + "Logging in";
- Session auth = this.createSession(this.username, this.password);
- if (auth == null) {
- this.status = (Object)((Object)ChatColor.RED) + "Login failed";
- } else {
- this.status = (Object)((Object)ChatColor.GREEN) + "Logged in. (" + auth.getUsername() + ")";
- this.mc.session = auth;
- }
- }
- public void setStatus(String status) {
- this.status = status;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement