/**
   * Method saveData.
   *
   * @param cw CursedWeapon
   */
  private void saveData(CursedWeapon cw) {
    Connection con = null;
    PreparedStatement statement = null;

    try {
      con = DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("DELETE FROM cursed_weapons WHERE item_id = ?");
      statement.setInt(1, cw.getItemId());
      statement.executeUpdate();

      if (cw.isActive()) {
        DbUtils.close(statement);
        statement =
            con.prepareStatement(
                "REPLACE INTO cursed_weapons (item_id, player_id, player_karma, player_pkkills, nb_kills, x, y, z, end_time) VALUES (?,?,?,?,?,?,?,?,?)");
        statement.setInt(1, cw.getItemId());
        statement.setInt(2, cw.getPlayerId());
        statement.setInt(3, cw.getPlayerKarma());
        statement.setInt(4, cw.getPlayerPkKills());
        statement.setInt(5, cw.getNbKills());
        statement.setInt(6, cw.getLoc().getX());
        statement.setInt(7, cw.getLoc().getY());
        statement.setInt(8, cw.getLoc().getZ());
        statement.setLong(9, cw.getEndTime() / 1000);
        statement.executeUpdate();
      }
    } catch (SQLException e) {
      _log.error("CursedWeapon: Failed to save data: " + e);
    } finally {
      DbUtils.closeQuietly(con, statement);
    }
  }
  /**
   * Method dropAttackable.
   *
   * @param attackable NpcInstance
   * @param killer Player
   */
  public void dropAttackable(NpcInstance attackable, Player killer) {
    if (killer.isInOlympiadMode()
        || killer.isCursedWeaponEquipped()
        || (_cursedWeapons.length == 0)
        || (killer.getReflection() != ReflectionManager.DEFAULT)) {
      return;
    }

    synchronized (_cursedWeapons) {
      CursedWeapon[] cursedWeapons = new CursedWeapon[0];

      for (CursedWeapon cw : _cursedWeapons) {
        if (cw.isActive()) {
          continue;
        }

        cursedWeapons = ArrayUtils.add(cursedWeapons, cw);
      }

      if (cursedWeapons.length > 0) {
        CursedWeapon cw = cursedWeapons[Rnd.get(cursedWeapons.length)];

        if (Rnd.get(100000000) <= cw.getDropRate()) {
          cw.create(attackable, killer);
        }
      }
    }
  }
 /** Method runImpl. */
 @Override
 public void runImpl() {
   for (CursedWeapon cw : _cursedWeapons) {
     if (cw.isActive() && (cw.getTimeLeft() <= 0)) {
       endOfLife(cw);
     }
   }
 }