com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication Java Examples
The following examples show how to use
com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Utils.java From ClientBase with MIT License | 5 votes |
public static Session createSession(String username, String password, @NotNull Proxy proxy) throws Exception { YggdrasilAuthenticationService service = new YggdrasilAuthenticationService(proxy, ""); YggdrasilUserAuthentication auth = (YggdrasilUserAuthentication) service .createUserAuthentication(Agent.MINECRAFT); auth.setUsername(username); auth.setPassword(password); auth.logIn(); return new Session(auth.getSelectedProfile().getName(), auth.getSelectedProfile().getId().toString(), auth.getAuthenticatedToken(), "mojang"); }
Example #2
Source File: MixinGuiDisconnected.java From LiquidBounce with GNU General Public License v3.0 | 4 votes |
@Inject(method = "actionPerformed", at = @At("HEAD")) private void actionPerformed(GuiButton button, CallbackInfo callbackInfo) { switch (button.id) { case 1: ServerUtils.connectToLastServer(); break; case 3: if (!GuiTheAltening.Companion.getApiKey().isEmpty()) { final String apiKey = GuiTheAltening.Companion.getApiKey(); final TheAltening theAltening = new TheAltening(apiKey); try { final AccountData account = theAltening.getAccountData(); GuiAltManager.altService.switchService(AltService.EnumAltService.THEALTENING); final YggdrasilUserAuthentication yggdrasilUserAuthentication = new YggdrasilUserAuthentication(new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""), Agent.MINECRAFT); yggdrasilUserAuthentication.setUsername(account.getToken()); yggdrasilUserAuthentication.setPassword(LiquidBounce.CLIENT_NAME); yggdrasilUserAuthentication.logIn(); mc.session = new Session(yggdrasilUserAuthentication.getSelectedProfile().getName(), yggdrasilUserAuthentication.getSelectedProfile().getId().toString(), yggdrasilUserAuthentication.getAuthenticatedToken(), "mojang"); LiquidBounce.eventManager.callEvent(new SessionEvent()); ServerUtils.connectToLastServer(); break; } catch (final Throwable throwable) { ClientUtils.getLogger().error("Failed to login into random account from TheAltening.", throwable); } } final List<MinecraftAccount> accounts = LiquidBounce.fileManager.accountsConfig.getAccounts(); if (accounts.isEmpty()) break; final MinecraftAccount minecraftAccount = accounts.get(new Random().nextInt(accounts.size())); GuiAltManager.login(minecraftAccount); ServerUtils.connectToLastServer(); break; case 4: LoginUtils.loginCracked(RandomUtils.randomString(RandomUtils.nextInt(5, 16))); ServerUtils.connectToLastServer(); break; case 5: AntiForge.enabled = !AntiForge.enabled; forgeBypassButton.displayString = "Bypass AntiForge: " + (AntiForge.enabled ? "On" : "Off"); LiquidBounce.fileManager.saveConfig(LiquidBounce.fileManager.valuesConfig); break; } }
Example #3
Source File: GuiAdd.java From LiquidBounce with GNU General Public License v3.0 | 4 votes |
private void addAccount(final String name, final String password) { if (LiquidBounce.fileManager.accountsConfig.accountExists(name)) { status = "§cThe account has already been added."; return; } addButton.enabled = clipboardButton.enabled = false; final MinecraftAccount account = new MinecraftAccount(name, password); new Thread(() -> { if (!account.isCracked()) { status = "§aChecking..."; try { final AltService.EnumAltService oldService = GuiAltManager.altService.getCurrentService(); if (oldService != AltService.EnumAltService.MOJANG) { GuiAltManager.altService.switchService(AltService.EnumAltService.MOJANG); } final YggdrasilUserAuthentication userAuthentication = (YggdrasilUserAuthentication) new YggdrasilAuthenticationService(Proxy.NO_PROXY, "") .createUserAuthentication(Agent.MINECRAFT); userAuthentication.setUsername(account.getName()); userAuthentication.setPassword(account.getPassword()); userAuthentication.logIn(); account.setAccountName(userAuthentication.getSelectedProfile().getName()); if (oldService == AltService.EnumAltService.THEALTENING) GuiAltManager.altService.switchService(AltService.EnumAltService.THEALTENING); } catch (NullPointerException | AuthenticationException | NoSuchFieldException | IllegalAccessException e) { status = "§cThe account doesn't work."; addButton.enabled = clipboardButton.enabled = true; return; } } LiquidBounce.fileManager.accountsConfig.getAccounts().add(account); LiquidBounce.fileManager.saveConfig(LiquidBounce.fileManager.accountsConfig); status = "§aThe account has been added."; prevGui.status = status; mc.displayGuiScreen(prevGui); }).start(); }
Example #4
Source File: MixinGuiDisconnect.java From LiquidBounce with GNU General Public License v3.0 | 4 votes |
@Inject(method = "actionPerformed", at = @At("HEAD")) private void actionPerformed(GuiButton button, CallbackInfo callbackInfo) { switch (button.id) { case 1: ServerUtils.connectToLastServer(); break; case 2: AntiForge.enabled = !AntiForge.enabled; forgeBypassButton.displayString = "Bypass AntiForge: " + (AntiForge.enabled ? "On" : "Off"); LiquidBounce.fileManager.saveConfig(LiquidBounce.fileManager.valuesConfig); break; case 3: if (!GuiTheAltening.Companion.getApiKey().isEmpty()) { final String apiKey = GuiTheAltening.Companion.getApiKey(); final TheAltening theAltening = new TheAltening(apiKey); try { final AccountData account = theAltening.getAccountData(); GuiAltManager.altService.switchService(AltService.EnumAltService.THEALTENING); final YggdrasilUserAuthentication yggdrasilUserAuthentication = new YggdrasilUserAuthentication(new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""), Agent.MINECRAFT); yggdrasilUserAuthentication.setUsername(account.getToken()); yggdrasilUserAuthentication.setPassword(LiquidBounce.CLIENT_NAME); yggdrasilUserAuthentication.logIn(); // TODO: no transformer rip // mc.session = new Session(yggdrasilUserAuthentication.getSelectedProfile().getName(), yggdrasilUserAuthentication.getSelectedProfile().getId().toString(), yggdrasilUserAuthentication.getAuthenticatedToken(), "mojang"); LiquidBounce.eventManager.callEvent(new SessionEvent()); ServerUtils.connectToLastServer(); break; } catch (final Throwable throwable) { ClientUtils.getLogger().error("Failed to login into random account from TheAltening.", throwable); } } final List<MinecraftAccount> accounts = LiquidBounce.fileManager.accountsConfig.altManagerMinecraftAccounts; if (accounts.isEmpty()) break; final MinecraftAccount minecraftAccount = accounts.get(new Random().nextInt(accounts.size())); GuiAltManager.login(minecraftAccount); ServerUtils.connectToLastServer(); break; case 4: LoginUtils.loginCracked(RandomUtils.randomString(RandomUtils.nextInt(5, 16))); ServerUtils.connectToLastServer(); break; } }