|
@@ -50,11 +50,12 @@ import com.l2jserver.util.Rnd;
|
|
|
|
|
|
public final class ItemAuctionInstance
|
|
|
{
|
|
|
- static final Logger _log = Logger.getLogger(ItemAuctionInstance.class.getName());
|
|
|
+ protected static final Logger _log = Logger.getLogger(ItemAuctionInstance.class.getName());
|
|
|
private final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("HH:mm:ss dd.MM.yy");
|
|
|
|
|
|
private static final long START_TIME_SPACE = TimeUnit.MILLISECONDS.convert(1, TimeUnit.MINUTES);
|
|
|
private static final long FINISH_TIME_SPACE = TimeUnit.MILLISECONDS.convert(10, TimeUnit.MINUTES);
|
|
|
+
|
|
|
/**
|
|
|
* Cached comparator to avoid initialization on each loop run.
|
|
|
*/
|
|
@@ -153,7 +154,7 @@ public final class ItemAuctionInstance
|
|
|
}
|
|
|
catch (final IllegalArgumentException e)
|
|
|
{
|
|
|
- _log.log(Level.WARNING, "ItemAuctionInstance: Failed loading auction item", e);
|
|
|
+ _log.log(Level.WARNING, getClass().getSimpleName() + ": Failed loading auction item", e);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -187,7 +188,7 @@ public final class ItemAuctionInstance
|
|
|
}
|
|
|
catch (final SQLException e)
|
|
|
{
|
|
|
- _log.log(Level.WARNING, "ItemAuctionInstance: Failed loading auction: " + auctionId, e);
|
|
|
+ _log.log(Level.WARNING, getClass().getSimpleName() + ": Failed loading auction: " + auctionId, e);
|
|
|
}
|
|
|
}
|
|
|
statement.close();
|
|
@@ -195,7 +196,7 @@ public final class ItemAuctionInstance
|
|
|
}
|
|
|
catch (final SQLException e)
|
|
|
{
|
|
|
- _log.log(Level.SEVERE, "L2ItemAuctionInstance: Failed loading auctions.", e);
|
|
|
+ _log.log(Level.SEVERE, getClass().getSimpleName() + ": Failed loading auctions.", e);
|
|
|
return;
|
|
|
}
|
|
|
finally
|
|
@@ -203,7 +204,7 @@ public final class ItemAuctionInstance
|
|
|
L2DatabaseFactory.close(con);
|
|
|
}
|
|
|
|
|
|
- _log.log(Level.INFO, "L2ItemAuctionInstance: Loaded " + _items.size() + " item(s) and registered " + _auctions.size() + " auction(s) for instance " + _instanceId + ".");
|
|
|
+ _log.log(Level.INFO, getClass().getSimpleName() + ": Loaded " + _items.size() + " item(s) and registered " + _auctions.size() + " auction(s) for instance " + _instanceId + ".");
|
|
|
checkAndSetCurrentAndNextAuction();
|
|
|
}
|
|
|
|
|
@@ -345,12 +346,12 @@ public final class ItemAuctionInstance
|
|
|
{
|
|
|
setStateTask(ThreadPoolManager.getInstance().scheduleGeneral(new ScheduleAuctionTask(currentAuction), Math.max(currentAuction.getStartingTime() - System.currentTimeMillis(), 0L)));
|
|
|
}
|
|
|
- _log.log(Level.INFO, "L2ItemAuctionInstance: Schedule current auction " + currentAuction.getAuctionId() + " for instance " + _instanceId);
|
|
|
+ _log.log(Level.INFO, getClass().getSimpleName() + ": Schedule current auction " + currentAuction.getAuctionId() + " for instance " + _instanceId);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
setStateTask(ThreadPoolManager.getInstance().scheduleGeneral(new ScheduleAuctionTask(nextAuction), Math.max(nextAuction.getStartingTime() - System.currentTimeMillis(), 0L)));
|
|
|
- _log.log(Level.INFO, "L2ItemAuctionInstance: Schedule next auction " + nextAuction.getAuctionId() + " on " + DATE_FORMAT.format(new Date(nextAuction.getStartingTime())) + " for instance " + _instanceId);
|
|
|
+ _log.log(Level.INFO, getClass().getSimpleName() + ": Schedule next auction " + nextAuction.getAuctionId() + " on " + DATE_FORMAT.format(new Date(nextAuction.getStartingTime())) + " for instance " + _instanceId);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -407,7 +408,7 @@ public final class ItemAuctionInstance
|
|
|
}
|
|
|
catch (final Exception e)
|
|
|
{
|
|
|
- _log.log(Level.SEVERE, "L2ItemAuctionInstance: Failed scheduling auction " + _auction.getAuctionId(), e);
|
|
|
+ _log.log(Level.SEVERE, getClass().getSimpleName() + ": Failed scheduling auction " + _auction.getAuctionId(), e);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -423,7 +424,7 @@ public final class ItemAuctionInstance
|
|
|
throw new IllegalStateException("Could not set auction state: " + ItemAuctionState.STARTED.toString() + ", expected: " + state.toString());
|
|
|
}
|
|
|
|
|
|
- _log.log(Level.INFO, "L2ItemAuctionInstance: Auction " + _auction.getAuctionId() + " has started for instance " + _auction.getInstanceId());
|
|
|
+ _log.log(Level.INFO, getClass().getSimpleName() + ": Auction " + _auction.getAuctionId() + " has started for instance " + _auction.getInstanceId());
|
|
|
checkAndSetCurrentAndNextAuction();
|
|
|
break;
|
|
|
}
|
|
@@ -506,7 +507,7 @@ public final class ItemAuctionInstance
|
|
|
player.getWarehouse().addItem("ItemAuction", item, null, null);
|
|
|
player.sendPacket(SystemMessageId.WON_BID_ITEM_CAN_BE_FOUND_IN_WAREHOUSE);
|
|
|
|
|
|
- _log.log(Level.INFO, "L2ItemAuctionInstance: Auction " + auction.getAuctionId() + " has finished. Highest bid by " + player.getName() + " for instance " + _instanceId);
|
|
|
+ _log.log(Level.INFO, getClass().getSimpleName() + ": Auction " + auction.getAuctionId() + " has finished. Highest bid by " + player.getName() + " for instance " + _instanceId);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -515,7 +516,7 @@ public final class ItemAuctionInstance
|
|
|
item.updateDatabase();
|
|
|
L2World.getInstance().removeObject(item);
|
|
|
|
|
|
- _log.log(Level.INFO, "L2ItemAuctionInstance: Auction " + auction.getAuctionId() + " has finished. Highest bid by " + CharNameTable.getInstance().getNameById(bid.getPlayerObjId()) + " for instance " + _instanceId);
|
|
|
+ _log.log(Level.INFO, getClass().getSimpleName() + ": Auction " + auction.getAuctionId() + " has finished. Highest bid by " + CharNameTable.getInstance().getNameById(bid.getPlayerObjId()) + " for instance " + _instanceId);
|
|
|
}
|
|
|
|
|
|
// Clean all canceled bids
|
|
@@ -523,7 +524,7 @@ public final class ItemAuctionInstance
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- _log.log(Level.INFO, "L2ItemAuctionInstance: Auction " + auction.getAuctionId() + " has finished. There have not been any bid for instance " + _instanceId);
|
|
|
+ _log.log(Level.INFO, getClass().getSimpleName() + ": Auction " + auction.getAuctionId() + " has finished. There have not been any bid for instance " + _instanceId);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -560,7 +561,7 @@ public final class ItemAuctionInstance
|
|
|
|
|
|
if (!rset.next())
|
|
|
{
|
|
|
- _log.log(Level.WARNING, "ItemAuctionInstance: Auction data not found for auction: " + auctionId);
|
|
|
+ _log.log(Level.WARNING, getClass().getSimpleName() + ": Auction data not found for auction: " + auctionId);
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -572,27 +573,27 @@ public final class ItemAuctionInstance
|
|
|
|
|
|
if (startingTime >= endingTime)
|
|
|
{
|
|
|
- _log.log(Level.WARNING, "ItemAuctionInstance: Invalid starting/ending paramaters for auction: " + auctionId);
|
|
|
+ _log.log(Level.WARNING, getClass().getSimpleName() + ": Invalid starting/ending paramaters for auction: " + auctionId);
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
final AuctionItem auctionItem = getAuctionItem(auctionItemId);
|
|
|
if (auctionItem == null)
|
|
|
{
|
|
|
- _log.log(Level.WARNING, "ItemAuctionInstance: AuctionItem: " + auctionItemId + ", not found for auction: " + auctionId);
|
|
|
+ _log.log(Level.WARNING, getClass().getSimpleName() + ": AuctionItem: " + auctionItemId + ", not found for auction: " + auctionId);
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
final ItemAuctionState auctionState = ItemAuctionState.stateForStateId(auctionStateId);
|
|
|
if (auctionState == null)
|
|
|
{
|
|
|
- _log.log(Level.WARNING, "ItemAuctionInstance: Invalid auctionStateId: " + auctionStateId + ", for auction: " + auctionId);
|
|
|
+ _log.log(Level.WARNING, getClass().getSimpleName() + ": Invalid auctionStateId: " + auctionStateId + ", for auction: " + auctionId);
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
if ((auctionState == ItemAuctionState.FINISHED) && (startingTime < (System.currentTimeMillis() - TimeUnit.MILLISECONDS.convert(Config.ALT_ITEM_AUCTION_EXPIRED_AFTER, TimeUnit.DAYS))))
|
|
|
{
|
|
|
- _log.log(Level.INFO, "ItemAuctionInstance: Clearing expired auction: " + auctionId);
|
|
|
+ _log.log(Level.INFO, getClass().getSimpleName() + ": Clearing expired auction: " + auctionId);
|
|
|
statement = con.prepareStatement("DELETE FROM item_auction WHERE auctionId=?");
|
|
|
statement.setInt(1, auctionId);
|
|
|
statement.execute();
|