示例#1
0
 /** End of auction */
 public void endAuction() {
   if (ClanHallManager.loaded()) {
     if (_highestBidderId == 0 && _sellerId == 0) {
       startAutoTask();
       return;
     }
     if (_highestBidderId == 0 && _sellerId > 0) {
       /** If seller haven't sell ClanHall, auction removed, THIS MUST BE CONFIRMED */
       int aucId = AuctionService.getInstance().getAuctionIndex(_id);
       AuctionService.getInstance().getAuctions().remove(aucId);
       return;
     }
     if (_sellerId > 0) {
       returnItem(_sellerClanName, PcInventory.ADENA_ID, _highestBidderMaxBid, true);
       returnItem(
           _sellerClanName,
           PcInventory.ADENA_ID,
           ClanHallManager.getInstance().getClanHallById(_itemId).getLease(),
           false);
     }
     deleteAuctionFromDB();
     L2Clan Clan =
         ClanTable.getInstance().getClanByName(_bidders.get(_highestBidderId).getClanName());
     _bidders.remove(_highestBidderId);
     Clan.setAuctionBiddedAt(0, true);
     removeBids();
     ClanHallManager.getInstance().setOwner(_itemId, Clan);
   } else {
     /** Task waiting ClanHallManager is loaded every 3s */
     ThreadPoolManager.getInstance().scheduleGeneral(new AutoEndTask(), 3000);
   }
 }
示例#2
0
 /** Task Manage */
 private void startAutoTask() {
   long currentTime = System.currentTimeMillis();
   long taskDelay = 0;
   if (_endDate <= currentTime) {
     _endDate = currentTime + 7 * 24 * 60 * 60 * 1000;
     saveAuctionDate();
   } else {
     taskDelay = _endDate - currentTime;
   }
   ThreadPoolManager.getInstance().scheduleGeneral(new AutoEndTask(), taskDelay);
 }