Exemple #1
0
  public User(boolean mTrue) {
    try {
      ResultSet mResult = Legion.getDetabase().executeQuery("SELECT * FROM  `users`");

      while (mResult.next()) {
        User h = new User();
        h.Id = mResult.getInt("id");
        h.userName = mResult.getString("username");
        h.realName = mResult.getString("realname");
        h.Look = mResult.getString("look");
        h.SSO = mResult.getString("ssoTicket");
        h.Email = mResult.getString("email");
        h.Mission = mResult.getString("mission");
        h.Coin = mResult.getInt("coins");
        h.OtherCoin = mResult.getInt("othercoins");
        h.Score = mResult.getInt("score");
        h.Gender = mResult.getString("Gender");
        h.Respects = mResult.getInt("Respects");
        h.maxUserRespects = mResult.getInt("Max_Users_Respects");
        h.maxPetsRespects = mResult.getInt("Max_Pets_Respects");
        h.Rank = mResult.getInt("rank");
        h.bannTime = mResult.getInt("ban_time");
        h.banCount = mResult.getInt("ban_count");
        h.habboClubInit = mResult.getString("Habbo_Club_Init");
        h.habboClubExpire = mResult.getString("Habbo_Club_Expire");
        DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        Date date = new Date();
        Date mDate = dateFormat.parse(h.habboClubExpire);
        h.Habbo_Club = (date.getTime() < mDate.getTime());
        h.isBanned = mResult.getBoolean("ban");
        h.isKuick = mResult.getBoolean("kuick");
        h.registredTime = mResult.getString("registred_time");
        h.lastLogin = mResult.getString("last_login");
        h.isOnline = false;
        h.isInRoom = false;
        h.isWriting = false;
        h.isWalking = false;
        h.x = 0;
        h.y = 0;
        h.z = 0.0;
        h.rot = 0;
        h.rothead = 0;
        getUserFromId.put(h.Id, h);
      }
      System.out.println("Loaded ".concat(getUserFromId.size() + " ").concat("user/s."));
      System.gc();
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Exemple #2
0
  public static User getHabboFromSSO(String SSO) {
    User mResult = null;
    try {
      Iterator reader = getUserFromId.entrySet().iterator();

      while (reader.hasNext()) {
        User nUser = (User) (((Map.Entry) reader.next()).getValue());
        if (nUser.SSO.equals(SSO)) {
          return nUser;
        }
      }
      ResultSet mResult2 =
          Legion.getDetabase()
              .executeQuery("SELECT * FROM  `users` WHERE `ssoTicket`='" + SSO + "'");
      if (mResult2.next()) {
        User h = new User();
        h.Id = mResult2.getInt("id");
        h.userName = mResult2.getString("username");
        h.realName = mResult2.getString("realname");
        h.Look = mResult2.getString("look");
        h.SSO = mResult2.getString("ssoTicket");
        h.Email = mResult2.getString("email");
        h.Mission = mResult2.getString("mission");
        h.Coin = mResult2.getInt("coins");
        h.OtherCoin = mResult2.getInt("othercoins");
        h.Score = mResult2.getInt("score");
        h.Gender = mResult2.getString("Gender");
        h.Respects = mResult2.getInt("Respects");
        h.maxUserRespects = mResult2.getInt("Max_Users_Respects");
        h.maxPetsRespects = mResult2.getInt("Max_Pets_Respects");
        h.Rank = mResult2.getInt("rank");
        h.bannTime = mResult2.getInt("ban_time");
        h.banCount = mResult2.getInt("ban_count");
        h.habboClubInit = mResult2.getString("Habbo_Club_Init");
        h.habboClubExpire = mResult2.getString("Habbo_Club_Expire");
        DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        Date date = new Date();
        Date mDate = dateFormat.parse(h.habboClubExpire);
        h.Habbo_Club = (date.getTime() < mDate.getTime());
        h.isBanned = mResult2.getBoolean("ban");
        h.isKuick = mResult2.getBoolean("kuick");
        h.registredTime = mResult2.getString("registred_time");
        h.lastLogin = mResult2.getString("last_login");
        h.isOnline = false;
        h.isInRoom = false;
        h.isWriting = false;
        h.isWalking = false;
        h.x = 0;
        h.y = 0;
        h.z = 0.0;
        h.rot = 0;
        h.rothead = 0;
        if (!getUserFromId.containsKey(h.Id)) getUserFromId.put(h.Id, h);
        else {
          getUserFromId.remove(h.Id);
          getUserFromId.put(h.Id, h);
        }
        mResult = h;
      }
    } catch (Exception ex) {
      ex.printStackTrace();
      return null;
    }
    return mResult;
  }