Package net.ftb.data

Examples of net.ftb.data.LoginResponse


                    unique = "1234567890";
                } else {
                    unique = uuid;
                }
                MCInstaller.launchMinecraft(Settings.getSettings().getInstallPath(), ModPack.getSelectedPack(),
                        new LoginResponse("1", "token", username, "offlinemods", unique, resp.getAuth()), legacy);

            }
        });

        abort.addActionListener(new ActionListener() {
View Full Code Here


    protected String doInBackground () {
        Benchmark.start("LoginWorker");
        try {
            if (Main.isAuthlibReadyToUse()) {
                try {
                    LoginResponse resp = AuthlibHelper.authenticateWithAuthlib(username, password, mojangData, selectedProfile);
                    this.resp = resp;
                    Benchmark.logBenchAs("LoginWorker", "Login Worker Run");
                    if (resp != null && resp.getUsername() != null && !resp.getUsername().isEmpty()) {
                        if (resp.getSessionID() != null) {
                            return "good";
                        } else {
                            return "offline";
                        }
                    }
                    if (resp == null) {
                        return "nullResponse";
                    }
                    if (resp.getUsername() == null) {
                        return "NullUsername";
                    }
                    return "bad";
                } catch (Exception e) {
                    Logger.logError("Error using authlib", e);
View Full Code Here

                        UserManager.setUUID(user, uniqueID);
                    }
                    if (uniqueID != null && !uniqueID.isEmpty()) {
                        UserManager.setUUID(user, uniqueID);
                        Logger.logDebug("Setting UUID and creating and returning new LoginResponse");
                        return new LoginResponse(Integer.toString(authentication.getAgent().getVersion()), "token", user, null, uniqueID, authentication);
                    }
                    ErrorUtils.tossError("Minecraft authentication servers might be down. Check @ help.mojang.com");
                    Logger.logDebug("failed", e);
                    Logger.logDebug("AuthenticationUnavailableException caused by", e.getCause());
                    return null;
                } catch (AuthenticationException e) {
                    Logger.logError("Unknown error from authlib:", e);
                    Logger.logDebug("AuthenticationException caused by", e.getCause());
                } catch (Exception e) {
                    Logger.logError("Unknown error from authlib: ", e);
                    Logger.logDebug("Exception caused by", e.getCause());
                }
            } else {
                Logger.logDebug("authentication.canLogIn() returned false");
            }

            if (isValid(authentication)) {
                Logger.logDebug("Authentication is valid ");
                displayName = authentication.getSelectedProfile().getName();
                if ((authentication.isLoggedIn()) && (authentication.canPlayOnline())) {
                    Logger.logDebug("loggedIn() && CanPlayOnline()");
                    if ((authentication instanceof YggdrasilUserAuthentication)) {
                        UserManager.setStore(user, encode(authentication.saveForStorage()));
                        UserManager.setUUID(user, authentication.getSelectedProfile().getId().toString());//enables use of offline mode later if needed on newer MC Versions
                        Logger.logDebug("Authentication done, returning LoginResponse");
                        return new LoginResponse(Integer.toString(authentication.getAgent().getVersion()), "token", displayName, authentication.getAuthenticatedToken(), authentication
                                .getSelectedProfile().getId().toString(), authentication);
                    }
                }
                Logger.logDebug("this should never happen: isLoggedIn: " + authentication.isLoggedIn() + " canPlayOnline(): " + authentication.canPlayOnline());
            } else if (authentication.getSelectedProfile() == null && (authentication.getAvailableProfiles() != null && authentication.getAvailableProfiles().length != 0)) {
                // user has more than one profile in his mojang acoount
                Logger.logInfo("You seem to have multiple profiles in  your account. Please contact FTB Launcher team if profiles are not working!");
                Logger.logDebug("User has more than one profile: " + toString(authentication));
                for (GameProfile profile : authentication.getAvailableProfiles()) {
                    if (selectedProfileName.equals(profile.getName())) {
                        Logger.logInfo("Selected profile: " + profile.getName());
                        selectedProfile = profile;
                    }
                }
                if (selectedProfile == null) {
                    Logger.logInfo("Profile not found, defaulting to first");
                    selectedProfile = authentication.getAvailableProfiles()[0];
                }
                Logger.logDebug("Authentication done, returning LoginResponse");
                return new LoginResponse(Integer.toString(authentication.getAgent().getVersion()), "token", selectedProfile.getName(), authentication.getAuthenticatedToken(),
                        selectedProfile.getId().toString(), authentication);
            } else if (authentication.getSelectedProfile() == null && (authentication.getAvailableProfiles() != null && authentication.getAvailableProfiles().length == 0)) {
                // user has 0 paid profiles in mojang account
                Logger.logDebug("No paid profiles in mojang account: " + toString(authentication));
                Logger.logError("You need paid minecraft to play FTB Modpacks...");
                ErrorUtils.showClickableMessage("You need paid minecraft to play FTB Modpacks:"
                        + "<ul>"
                        + "<li>Your login credentials are correct but mojang's authentication server does not find paid profile in your account"
                        + "<li>If you believe this is error, please try vanilla launcher and minecraft.net before contacting FTB support"
                        + "</ul>"
                        , "https://help.mojang.com/customer/portal/articles/1218766-can-only-play-minecraft-demo");
                return null;
            } else {
                Logger.logDebug("this should never happen: " + toString(authentication));
            }

        } else {
            Logger.logDebug("this should never happen");
        }

        if (hasMojangData) {
            Logger.logError("Failed to authenticate with mojang data, attempting to use username & password");
            if (!hasPassword) {
                new PasswordDialog(LaunchFrame.getInstance(), true).setVisible(true);
                if (LaunchFrame.tempPass.isEmpty()) {
                    return null;
                }
                pass = LaunchFrame.tempPass;
            }

            LoginResponse l = authenticateWithAuthlib(user, pass, null, selectedProfileName);
            if (l == null) {
                Logger.logError("Failed to login with username & password");
                return null;
            } else {
                Logger.logDebug("authentication ready, returning LoginResponse from authlib");
View Full Code Here

TOP

Related Classes of net.ftb.data.LoginResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.