public void onDetection(L1PcInstance caster) {
    L1Location loc = caster.getLocation();

    for (L1TrapInstance trap : _allTraps) {
      if (trap.isEnable() && loc.isInScreen(trap.getLocation())) {
        trap.onDetection(caster);
        disableTrap(trap);
      }
    }
  }
  public void onPlayerMoved(L1PcInstance player) {
    L1Location loc = player.getLocation();

    for (L1TrapInstance trap : _allTraps) {
      if (trap.isEnable() && loc.equals(trap.getLocation())) {
        trap.onTrod(player);
        disableTrap(trap);
      }
    }
  }
  private void initialize() {
    Connection con = null;
    PreparedStatement pstm = null;
    ResultSet rs = null;

    try {
      con = L1DatabaseFactory.getInstance().getConnection();

      pstm = con.prepareStatement("SELECT * FROM spawnlist_trap");

      rs = pstm.executeQuery();

      while (rs.next()) {
        int trapId = rs.getInt("trapId");
        L1Trap trapTemp = TrapTable.getInstance().getTemplate(trapId);
        L1Location loc = new L1Location();
        loc.setMap(rs.getInt("mapId"));
        loc.setX(rs.getInt("locX"));
        loc.setY(rs.getInt("locY"));
        Point rndPt = new Point();
        rndPt.setX(rs.getInt("locRndX"));
        rndPt.setY(rs.getInt("locRndY"));
        int count = rs.getInt("count");
        int span = rs.getInt("span");

        for (int i = 0; i < count; i++) {
          L1TrapInstance trap =
              new L1TrapInstance(IdFactory.getInstance().nextId(), trapTemp, loc, rndPt, span);
          L1World.getInstance().addVisibleObject(trap);
          _allTraps.add(trap);
        }
        L1TrapInstance base = new L1TrapInstance(IdFactory.getInstance().nextId(), loc);
        L1World.getInstance().addVisibleObject(base);
        _allBases.add(base);
      }

    } catch (SQLException e) {
      _log.log(Level.SEVERE, e.getLocalizedMessage(), e);
    } finally {
      SQLUtil.close(rs);
      SQLUtil.close(pstm);
      SQLUtil.close(con);
    }
  }