@Override
  public void joinServer(GameProfile profile, String accessToken, String serverID)
      throws AuthenticationException {
    if (!ClientLauncher.isLaunched()) {
      throw new AuthenticationException("Bad Login (Cheater)");
    }

    // Join server
    String username = profile.getName();
    LogHelper.debug(
        "joinServer, Username: '******', Access token: %s, Server ID: %s",
        username, accessToken, serverID);

    // Make joinServer request
    boolean success;
    try {
      success = new JoinServerRequest(username, accessToken, serverID).request();
    } catch (Exception e) {
      throw new AuthenticationUnavailableException(e);
    }

    // Verify is success
    if (!success) {
      throw new AuthenticationException("Bad Login (Clientside)");
    }
  }
예제 #2
0
 private static String getTextureURL(String url, UUID uuid, String username) {
   return CommonHelper.replace(
       url,
       "username",
       IOHelper.urlEncode(username),
       "uuid",
       IOHelper.urlEncode(uuid.toString()),
       "hash",
       IOHelper.urlEncode(ClientLauncher.toHash(uuid)));
 }