/** @see com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket#runImpl() */
 @Override
 protected void runImpl() {
   L2GameClient client = this.getClient();
   if (client != null) {
     client.sendPacket(new ExShowAgitInfo());
   }
 }
  public boolean savePassword(String password) {
    if (passwordExist()) {
      _log.warning(
          "[SecondaryPasswordAuth]" + _activeClient.getAccountName() + " forced savePassword");
      _activeClient.closeNow();
      return false;
    }

    if (!validatePassword(password)) {
      _activeClient.sendPacket(new Ex2ndPasswordAck(Ex2ndPasswordAck.WRONG_PATTERN));
      return false;
    }

    password = cryptPassword(password);

    Connection con = null;
    try {
      con = L2DatabaseFactory.getInstance().getConnection();
      PreparedStatement statement = con.prepareStatement(INSERT_PASSWORD);
      statement.setString(1, _activeClient.getAccountName());
      statement.setString(2, VAR_PWD);
      statement.setString(3, password);
      statement.execute();
      statement.close();
    } catch (Exception e) {
      _log.log(Level.SEVERE, "Error while writing password.", e);
      return false;
    } finally {
      L2DatabaseFactory.close(con);
    }
    _password = password;
    return true;
  }
  public boolean checkPassword(String password, boolean skipAuth) {
    password = cryptPassword(password);

    if (!password.equals(_password)) {
      _wrongAttempts++;
      if (_wrongAttempts < Config.SECOND_AUTH_MAX_ATTEMPTS) {
        _activeClient.sendPacket(
            new Ex2ndPasswordVerify(Ex2ndPasswordVerify.PASSWORD_WRONG, _wrongAttempts));
        insertWrongAttempt(_wrongAttempts);
      } else {
        LoginServerThread.getInstance()
            .sendTempBan(
                _activeClient.getAccountName(),
                _activeClient.getConnectionAddress().getHostAddress(),
                Config.SECOND_AUTH_BAN_TIME);
        LoginServerThread.getInstance()
            .sendMail(
                _activeClient.getAccountName(),
                "SATempBan",
                _activeClient.getConnectionAddress().getHostAddress(),
                Integer.toString(Config.SECOND_AUTH_MAX_ATTEMPTS),
                Long.toString(Config.SECOND_AUTH_BAN_TIME),
                Config.SECOND_AUTH_REC_LINK);
        _log.warning(
            _activeClient.getAccountName()
                + " - ("
                + _activeClient.getConnectionAddress().getHostAddress()
                + ") has inputted the wrong password "
                + _wrongAttempts
                + " times in row.");
        insertWrongAttempt(0);
        _activeClient.close(
            new Ex2ndPasswordVerify(
                Ex2ndPasswordVerify.PASSWORD_BAN, Config.SECOND_AUTH_MAX_ATTEMPTS));
      }
      return false;
    }
    if (!skipAuth) {
      _authed = true;
      _activeClient.sendPacket(
          new Ex2ndPasswordVerify(Ex2ndPasswordVerify.PASSWORD_OK, _wrongAttempts));
    }
    insertWrongAttempt(0);
    return true;
  }
 @Override
 protected void runImpl() {
   L2GameClient client = getClient();
   if (client != null) {
     L2Object object = L2World.getInstance().findObject(_objectId);
     if (object instanceof L2ItemInstance) {
       L2ItemInstance item = (L2ItemInstance) object;
       if (item.isPublished()) {
         client.sendPacket(new ExRpItemLink(item));
       } else {
         if (Config.DEBUG) {
           _log.info(
               getClient()
                   + " requested item link for item which wasnt published! ID:"
                   + _objectId);
         }
       }
     }
   }
 }
  public boolean changePassword(String oldPassword, String newPassword) {
    if (!passwordExist()) {
      _log.warning(
          "[SecondaryPasswordAuth]" + _activeClient.getAccountName() + " forced changePassword");
      _activeClient.closeNow();
      return false;
    }

    if (!checkPassword(oldPassword, true)) return false;

    if (!validatePassword(newPassword)) {
      _activeClient.sendPacket(new Ex2ndPasswordAck(Ex2ndPasswordAck.WRONG_PATTERN));
      return false;
    }

    newPassword = cryptPassword(newPassword);

    Connection con = null;
    try {
      con = L2DatabaseFactory.getInstance().getConnection();
      PreparedStatement statement = con.prepareStatement(UPDATE_PASSWORD);
      statement.setString(1, newPassword);
      statement.setString(2, _activeClient.getAccountName());
      statement.setString(3, VAR_PWD);
      statement.execute();
      statement.close();
    } catch (Exception e) {
      _log.log(Level.SEVERE, "Error while reading password.", e);
      return false;
    } finally {
      L2DatabaseFactory.close(con);
    }
    _password = newPassword;
    _authed = false;
    return true;
  }
 public void openDialog() {
   if (passwordExist())
     _activeClient.sendPacket(new Ex2ndPasswordCheck(Ex2ndPasswordCheck.PASSWORD_PROMPT));
   else _activeClient.sendPacket(new Ex2ndPasswordCheck(Ex2ndPasswordCheck.PASSWORD_NEW));
 }