Java Code Examples for com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication#setPassword()

The following examples show how to use com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication#setPassword() . 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 vote down vote up
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 vote down vote up
@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: MixinGuiDisconnect.java    From LiquidBounce with GNU General Public License v3.0 4 votes vote down vote up
@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;
    }
}