gpt4 book ai didi

com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication类的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 14:10:31 27 4
gpt4 key购买 nike

本文整理了Java中com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication类的一些代码示例,展示了YggdrasilUserAuthentication类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YggdrasilUserAuthentication类的具体详情如下:
包路径:com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication
类名称:YggdrasilUserAuthentication

YggdrasilUserAuthentication介绍

暂无

代码示例

代码示例来源:origin: Slowpoke101/FTBLaunch

public static String toString (YggdrasilUserAuthentication y) {
  return "YggdrasilAuthenticationService{profiles=" + Arrays.toString(y.getAvailableProfiles()) + ", selectedProfile=" + y.getSelectedProfile() + ", isLoggedIn=" + y.isLoggedIn() + ", userType="
      + y.getUserType() + ", canPlayOnline=" + y.canPlayOnline() + "}";
}

代码示例来源:origin: ATLauncher/ATLauncher

public boolean isValidAuth() {
  if (!this.hasAuth()) {
    return false;
  }
  if (!this.auth.isLoggedIn()) {
    this.setErrorMessage("Response from Mojang wasn't valid!");
  } else if (this.auth.getAuthenticatedToken() == null) {
    this.setErrorMessage("No authentication token returned from Mojang!");
  } else if (auth.getSelectedProfile() == null && (this.auth.getAvailableProfiles() == null || this.auth
      .getAvailableProfiles().length == 0)) {
    this.setErrorMessage("There are no paid copies of Minecraft associated with this account!");
  } else if (this.auth.getSelectedProfile() == null) {
    this.setErrorMessage("No profile selected!");
  }
  return !this.hasError;
}

代码示例来源:origin: ATLauncher/ATLauncher

public void save() {
    Account account = App.settings.getAccountByName(this.username);

    if (account != null) {
      account.saveStore(this.auth.saveForStorage());
    }
  }
}

代码示例来源:origin: Slowpoke101/FTBLaunch

private static boolean isValid (YggdrasilUserAuthentication authentication) {
  boolean ret = true;
  if (!authentication.isLoggedIn()) {
    Logger.logDebug("authentication not valid");
    ret = false;
  }
  if (authentication.getAuthenticatedToken() == null) {
    Logger.logDebug("authentication not valid");
    ret = false;
  }
  if (authentication.getSelectedProfile() == null) {
    Logger.logDebug("authentication not valid");
    ret = false;
  }
  return ret;
}

代码示例来源:origin: Slowpoke101/FTBLaunch

Logger.logInfo("Beginning authlib authentication attempt");
Logger.logInfo("successfully created YggdrasilAuthenticationService");
authentication.setUsername(user);
if (pass != null && !pass.isEmpty()) {
  authentication.setPassword(pass);
  hasPassword = true;
  if (m != null) {
    Logger.logDebug("Loading mojangData into authlib");
    authentication.loadFromStorage(m);
    hasMojangData = true;
if (authentication.canLogIn()) {
  try {
    authentication.logIn();
  } catch (UserMigratedException e) {
    Logger.logError(e.toString());
    Logger.logError("Invalid credentials recieved for user: " + user, e);
    if (hasMojangData && hasPassword) {
      uniqueID = authentication.getSelectedProfile().getId().toString();
      uniqueID = authentication.getSelectedProfile().getId().toString();
      if (uniqueID != null && !uniqueID.isEmpty()) {
        Logger.logDebug("Setting UUID");
      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);

代码示例来源:origin: ATLauncher/ATLauncher

auth.loadFromStorage(account.getStore());
  auth.logOut();
  auth.setUsername(account.getUsername());
  auth.setPassword(account.getPassword());
if (auth.canLogIn()) {
  try {
    auth.logIn();
    response.setAuth(auth);
    response.save();

代码示例来源:origin: ATLauncher/ATLauncher

public String getSession(LoginResponse response) {
  if (!response.isOffline() && response != null && response.getAuth().isLoggedIn() && response.getAuth()
    .canPlayOnline()) {
    if (response.getAuth() instanceof YggdrasilUserAuthentication) {
      return String.format("token:%s:%s", response.getAuth().getAuthenticatedToken(), UUIDTypeAdapter
        .fromUUID(response.getAuth().getSelectedProfile().getId()));
    } else {
      return response.getAuth().getAuthenticatedToken();
    }
  }
  return "token:0:0";
}

代码示例来源:origin: ATLauncher/ATLauncher

public static LoginResponse checkAccount(String username, String password, String clientToken) {
  YggdrasilUserAuthentication auth = (YggdrasilUserAuthentication) new YggdrasilAuthenticationService(App
      .settings.getProxyForAuth(), clientToken).createUserAuthentication(Agent.MINECRAFT);
  LoginResponse response = new LoginResponse(username);
  auth.setUsername(username);
  auth.setPassword(password);
  if (auth.canLogIn()) {
    try {
      auth.logIn();
      response.setAuth(auth);
    } catch (AuthenticationException e) {
      response.setErrorMessage(e.getMessage());
      LogManager.logStackTrace("Authentication failed", e);
    }
  }
  return response;
}

代码示例来源:origin: ATLauncher/ATLauncher

if (!response.isOffline() && !response.getAuth().canPlayOnline()) {
  return null;
  this.setAccessToken(response.getAuth().getAuthenticatedToken());
  this.setUUID(response.getAuth().getSelectedProfile().getId().toString());
  response.save();
  App.settings.saveAccounts();

代码示例来源:origin: ATLauncher/ATLauncher

props = gson.toJson(response.getAuth().getUserProperties());
  argument = argument.replace("${user_type}",
      response.isOffline() ? com.mojang.authlib.UserType.MOJANG.getName()
          : response.getAuth().getUserType().getName());

代码示例来源:origin: ATLauncher/ATLauncher

arguments.add(sess.getAuth().getAuthenticatedToken()); // Session
  argsString = argsString.replace(sess.getAuth().getAuthenticatedToken(), "REDACTED");

代码示例来源:origin: ATLauncher/ATLauncher

if (response != null && response.hasAuth() && response.isValidAuth()) {
  if (accountsComboBox.getSelectedIndex() == 0) {
    account = new Account(username, password, response.getAuth().getSelectedProfile().getName(),
        response.getAuth().getSelectedProfile().getId().toString(), remember);
    App.settings.addAccount(account);
    LogManager.info("Added Account " + account);
    account = (Account) accountsComboBox.getSelectedItem();
    account.setUsername(username);
    account.setMinecraftUsername(response.getAuth().getSelectedProfile().getName());
    account.setUUID(response.getAuth().getSelectedProfile().getId().toString());
    if (remember) {
      account.setPassword(password);

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com