public void delVisualObject(VisibleObject object, boolean isOutOfRange) {
   if (visualObjects.remove(object.getObjectId()) != null) {
     if (visualPlayers != null) {
       visualPlayers.remove(object.getObjectId());
     }
     owner.getController().notSee(object, isOutOfRange);
   }
 }
 /**
  * Delete VisibleObject from this KnownList.
  *
  * @param object
  */
 private void del(VisibleObject object, boolean isOutOfRange) {
   /** object was known. */
   if (knownObjects.remove(object.getObjectId()) != null) {
     if (knownPlayers != null) {
       knownPlayers.remove(object.getObjectId());
     }
     delVisualObject(object, isOutOfRange);
   }
 }
 public boolean tooFast(String ip) {
   String[] exclIps = Config.EXCLUDED_IP.split(",");
   for (String exclIp : exclIps) {
     if (ip.equals(exclIp)) return false;
   }
   Long banned = ban.get(ip);
   if (banned != null) {
     if (System.currentTimeMillis() < banned) return true;
     else {
       ban.remove(ip);
       return false;
     }
   }
   Long time = flood.get(ip);
   if (time == null) {
     flood.put(ip, System.currentTimeMillis() + Config.FAST_RECONNECTION_TIME * 1000);
     return false;
   } else {
     if (time > System.currentTimeMillis()) {
       log.info(
           "[AUDIT]FloodProtector:"
               + ip
               + " IP too fast connection attemp. blocked for "
               + Config.WRONG_LOGIN_BAN_TIME
               + " min");
       ban.put(ip, System.currentTimeMillis() + Config.WRONG_LOGIN_BAN_TIME * 60000);
       return true;
     } else return false;
   }
 }
Esempio n. 4
0
 public boolean updateFunctions(
     L2PcInstance player, int type, int lvl, int lease, long rate, boolean addNew) {
   if (player == null) return false;
   if (_log.isDebugEnabled())
     _log.warn(
         "Called Fort.updateFunctions(int type, int lvl, int lease, long rate, boolean addNew) Owner : "
             + getOwnerId());
   if (lease > 0) {
     if (!player.destroyItemByItemId("Consume", 57, lease, null, true)) return false;
   }
   if (addNew) _function.put(type, new FortFunction(type, lvl, lease, 0, rate, 0, false));
   else {
     if (lvl == 0 && lease == 0) removeFunction(type);
     else {
       int diffLease = lease - _function.get(type).getLease();
       if (_log.isDebugEnabled())
         _log.warn("Called Fort.updateFunctions diffLease : " + diffLease);
       if (diffLease > 0) {
         _function.remove(type);
         _function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false));
       } else {
         _function.get(type).setLease(lease);
         _function.get(type).setLvl(lvl);
         _function.get(type).dbSave(false);
       }
     }
   }
   return true;
 }
Esempio n. 5
0
 private FastMap newLocalMap() {
   // First, do some cleanup (remove dead threads).
   for (FastMap.Entry e = THREAD_TO_LOCAL_MAP.head(), end = THREAD_TO_LOCAL_MAP.tail();
       (e = (FastMap.Entry) e.getNext()) != end; ) {
     Thread thread = (Thread) e.getKey();
     if (!thread.isAlive()) {
       THREAD_TO_LOCAL_MAP.remove(thread);
     }
   }
   FastMap localMap = new FastMap();
   THREAD_TO_LOCAL_MAP.put(Thread.currentThread(), localMap);
   return localMap;
 }
Esempio n. 6
0
 /** Remove function In List and in DB */
 public void removeFunction(int functionType) {
   _function.remove(functionType);
   Connection con = null;
   try {
     PreparedStatement statement;
     con = L2DatabaseFactory.getInstance().getConnection(con);
     statement = con.prepareStatement("DELETE FROM fort_functions WHERE fortId=? AND type=?");
     statement.setInt(1, getFortId());
     statement.setInt(2, functionType);
     statement.execute();
     statement.close();
   } catch (Exception e) {
     _log.fatal("Exception: Fort.removeFunctions(int functionType): " + e.getMessage(), e);
   } finally {
     try {
       con.close();
     } catch (Exception e) {
     }
   }
 }
Esempio n. 7
0
 /**
  * Remove AionObject from region objects list.
  *
  * @param object
  */
 void remove(VisibleObject object) {
   objects.remove(object.getObjectId());
 }
Esempio n. 8
0
 /** @param cooldownId */
 public void removeSkillCoolDown(int cooldownId) {
   if (skillCoolDowns == null) return;
   skillCoolDowns.remove(cooldownId);
   if (skillCoolDownsBase != null) skillCoolDownsBase.remove(cooldownId);
 }