Some code formatting.
This commit is contained in:
@@ -40,7 +40,7 @@ public final class AuctionDateGenerator
|
||||
private int _hour_of_day;
|
||||
private int _minute_of_hour;
|
||||
|
||||
public AuctionDateGenerator(final StatsSet config) throws IllegalArgumentException
|
||||
public AuctionDateGenerator(StatsSet config) throws IllegalArgumentException
|
||||
{
|
||||
_calendar = Calendar.getInstance();
|
||||
_interval = config.getInt(FIELD_INTERVAL, -1);
|
||||
@@ -55,7 +55,7 @@ public final class AuctionDateGenerator
|
||||
checkMinuteOfHour(0);
|
||||
}
|
||||
|
||||
public synchronized final long nextDate(final long date)
|
||||
public synchronized final long nextDate(long date)
|
||||
{
|
||||
_calendar.setTimeInMillis(date);
|
||||
_calendar.set(Calendar.MILLISECOND, 0);
|
||||
@@ -72,7 +72,7 @@ public final class AuctionDateGenerator
|
||||
return calcDestTime(_calendar.getTimeInMillis(), date, TimeUnit.MILLISECONDS.convert(_interval, TimeUnit.DAYS));
|
||||
}
|
||||
|
||||
private final long calcDestTime(long time, final long date, final long add)
|
||||
private final long calcDestTime(long time, long date, long add)
|
||||
{
|
||||
if (time < date)
|
||||
{
|
||||
@@ -85,7 +85,7 @@ public final class AuctionDateGenerator
|
||||
return time;
|
||||
}
|
||||
|
||||
private final void checkDayOfWeek(final int defaultValue)
|
||||
private final void checkDayOfWeek(int defaultValue)
|
||||
{
|
||||
if ((_day_of_week < 1) || (_day_of_week > 7))
|
||||
{
|
||||
@@ -101,7 +101,7 @@ public final class AuctionDateGenerator
|
||||
}
|
||||
}
|
||||
|
||||
private final void checkHourOfDay(final int defaultValue)
|
||||
private final void checkHourOfDay(int defaultValue)
|
||||
{
|
||||
if ((_hour_of_day < 0) || (_hour_of_day > 23))
|
||||
{
|
||||
@@ -113,7 +113,7 @@ public final class AuctionDateGenerator
|
||||
}
|
||||
}
|
||||
|
||||
private final void checkMinuteOfHour(final int defaultValue)
|
||||
private final void checkMinuteOfHour(int defaultValue)
|
||||
{
|
||||
if ((_minute_of_hour < 0) || (_minute_of_hour > 59))
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ public final class AuctionItem
|
||||
private final long _itemCount;
|
||||
private final StatsSet _itemExtra;
|
||||
|
||||
public AuctionItem(final int auctionItemId, final int auctionLength, final long auctionInitBid, final int itemId, final long itemCount, final StatsSet itemExtra)
|
||||
public AuctionItem(int auctionItemId, int auctionLength, long auctionInitBid, int itemId, long itemCount, StatsSet itemExtra)
|
||||
{
|
||||
_auctionItemId = auctionItemId;
|
||||
_auctionLength = auctionLength;
|
||||
|
||||
@@ -67,12 +67,12 @@ public final class ItemAuction
|
||||
private static final String DELETE_ITEM_AUCTION_BID = "DELETE FROM item_auction_bid WHERE auctionId = ? AND playerObjId = ?";
|
||||
private static final String INSERT_ITEM_AUCTION_BID = "INSERT INTO item_auction_bid (auctionId, playerObjId, playerBid) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE playerBid = ?";
|
||||
|
||||
public ItemAuction(final int auctionId, final int instanceId, final long startingTime, final long endingTime, final AuctionItem auctionItem)
|
||||
public ItemAuction(int auctionId, int instanceId, long startingTime, long endingTime, AuctionItem auctionItem)
|
||||
{
|
||||
this(auctionId, instanceId, startingTime, endingTime, auctionItem, new ArrayList<>(), ItemAuctionState.CREATED);
|
||||
}
|
||||
|
||||
public ItemAuction(final int auctionId, final int instanceId, final long startingTime, final long endingTime, final AuctionItem auctionItem, final List<ItemAuctionBid> auctionBids, final ItemAuctionState auctionState)
|
||||
public ItemAuction(int auctionId, int instanceId, long startingTime, long endingTime, AuctionItem auctionItem, List<ItemAuctionBid> auctionBids, ItemAuctionState auctionState)
|
||||
{
|
||||
_auctionId = auctionId;
|
||||
_instanceId = instanceId;
|
||||
@@ -110,7 +110,7 @@ public final class ItemAuction
|
||||
return auctionState;
|
||||
}
|
||||
|
||||
public final boolean setAuctionState(final ItemAuctionState expected, final ItemAuctionState wanted)
|
||||
public final boolean setAuctionState(ItemAuctionState expected, ItemAuctionState wanted)
|
||||
{
|
||||
synchronized (_auctionStateLock)
|
||||
{
|
||||
@@ -210,20 +210,20 @@ public final class ItemAuction
|
||||
}
|
||||
}
|
||||
|
||||
public final int getAndSetLastBidPlayerObjectId(final int playerObjId)
|
||||
public final int getAndSetLastBidPlayerObjectId(int playerObjId)
|
||||
{
|
||||
final int lastBid = _lastBidPlayerObjId;
|
||||
_lastBidPlayerObjId = playerObjId;
|
||||
return lastBid;
|
||||
}
|
||||
|
||||
private final void updatePlayerBid(final ItemAuctionBid bid, final boolean delete)
|
||||
private final void updatePlayerBid(ItemAuctionBid bid, boolean delete)
|
||||
{
|
||||
// TODO nBd maybe move such stuff to you db updater :D
|
||||
updatePlayerBidInternal(bid, delete);
|
||||
}
|
||||
|
||||
final void updatePlayerBidInternal(final ItemAuctionBid bid, final boolean delete)
|
||||
final void updatePlayerBidInternal(ItemAuctionBid bid, boolean delete)
|
||||
{
|
||||
final String query = delete ? DELETE_ITEM_AUCTION_BID : INSERT_ITEM_AUCTION_BID;
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
@@ -244,7 +244,7 @@ public final class ItemAuction
|
||||
}
|
||||
}
|
||||
|
||||
public final void registerBid(final L2PcInstance player, final long newBid)
|
||||
public final void registerBid(L2PcInstance player, long newBid)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
@@ -325,7 +325,7 @@ public final class ItemAuction
|
||||
}
|
||||
}
|
||||
|
||||
private final void onPlayerBid(final L2PcInstance player, final ItemAuctionBid bid)
|
||||
private final void onPlayerBid(L2PcInstance player, ItemAuctionBid bid)
|
||||
{
|
||||
if (_highestBid == null)
|
||||
{
|
||||
@@ -400,12 +400,12 @@ public final class ItemAuction
|
||||
}
|
||||
}
|
||||
|
||||
public final void broadcastToAllBidders(final L2GameServerPacket packet)
|
||||
public final void broadcastToAllBidders(L2GameServerPacket packet)
|
||||
{
|
||||
ThreadPoolManager.getInstance().executeGeneral(() -> broadcastToAllBiddersInternal(packet));
|
||||
}
|
||||
|
||||
public final void broadcastToAllBiddersInternal(final L2GameServerPacket packet)
|
||||
public final void broadcastToAllBiddersInternal(L2GameServerPacket packet)
|
||||
{
|
||||
for (int i = _auctionBids.size(); i-- > 0;)
|
||||
{
|
||||
@@ -421,7 +421,7 @@ public final class ItemAuction
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean cancelBid(final L2PcInstance player)
|
||||
public final boolean cancelBid(L2PcInstance player)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
@@ -508,7 +508,7 @@ public final class ItemAuction
|
||||
}
|
||||
}
|
||||
|
||||
private final boolean reduceItemCount(final L2PcInstance player, final long count)
|
||||
private final boolean reduceItemCount(L2PcInstance player, long count)
|
||||
{
|
||||
if (!player.reduceAdena("ItemAuction", count, player, true))
|
||||
{
|
||||
@@ -518,7 +518,7 @@ public final class ItemAuction
|
||||
return true;
|
||||
}
|
||||
|
||||
private final void increaseItemCount(final L2PcInstance player, final long count)
|
||||
private final void increaseItemCount(L2PcInstance player, long count)
|
||||
{
|
||||
player.addAdena("ItemAuction", count, player, true);
|
||||
}
|
||||
@@ -528,19 +528,19 @@ public final class ItemAuction
|
||||
* @param player The player that made the bid
|
||||
* @return The last bid the player made or -1
|
||||
*/
|
||||
public final long getLastBid(final L2PcInstance player)
|
||||
public final long getLastBid(L2PcInstance player)
|
||||
{
|
||||
final ItemAuctionBid bid = getBidFor(player.getObjectId());
|
||||
return bid != null ? bid.getLastBid() : -1L;
|
||||
}
|
||||
|
||||
public final ItemAuctionBid getBidFor(final int playerObjId)
|
||||
public final ItemAuctionBid getBidFor(int playerObjId)
|
||||
{
|
||||
final int index = getBidIndexFor(playerObjId);
|
||||
return index != -1 ? _auctionBids.get(index) : null;
|
||||
}
|
||||
|
||||
private final int getBidIndexFor(final int playerObjId)
|
||||
private final int getBidIndexFor(int playerObjId)
|
||||
{
|
||||
for (int i = _auctionBids.size(); i-- > 0;)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ public final class ItemAuctionBid
|
||||
private final int _playerObjId;
|
||||
private long _lastBid;
|
||||
|
||||
public ItemAuctionBid(final int playerObjId, final long lastBid)
|
||||
public ItemAuctionBid(int playerObjId, long lastBid)
|
||||
{
|
||||
_playerObjId = playerObjId;
|
||||
_lastBid = lastBid;
|
||||
@@ -43,7 +43,7 @@ public final class ItemAuctionBid
|
||||
return _lastBid;
|
||||
}
|
||||
|
||||
final void setLastBid(final long lastBid)
|
||||
final void setLastBid(long lastBid)
|
||||
{
|
||||
_lastBid = lastBid;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public final class ItemAuctionInstance
|
||||
private ItemAuction _nextAuction;
|
||||
private ScheduledFuture<?> _stateTask;
|
||||
|
||||
public ItemAuctionInstance(final int instanceId, final AtomicInteger auctionIds, final Node node) throws Exception
|
||||
public ItemAuctionInstance(int instanceId, AtomicInteger auctionIds, Node node) throws Exception
|
||||
{
|
||||
_instanceId = instanceId;
|
||||
_auctionIds = auctionIds;
|
||||
@@ -219,7 +219,7 @@ public final class ItemAuctionInstance
|
||||
}
|
||||
}
|
||||
|
||||
private final AuctionItem getAuctionItem(final int auctionItemId)
|
||||
private final AuctionItem getAuctionItem(int auctionItemId)
|
||||
{
|
||||
for (int i = _items.size(); i-- > 0;)
|
||||
{
|
||||
@@ -344,12 +344,12 @@ public final class ItemAuctionInstance
|
||||
}
|
||||
}
|
||||
|
||||
public final ItemAuction getAuction(final int auctionId)
|
||||
public final ItemAuction getAuction(int auctionId)
|
||||
{
|
||||
return _auctions.get(auctionId);
|
||||
}
|
||||
|
||||
public final ItemAuction[] getAuctionsByBidder(final int bidderObjId)
|
||||
public final ItemAuction[] getAuctionsByBidder(int bidderObjId)
|
||||
{
|
||||
final Collection<ItemAuction> auctions = getAuctions();
|
||||
final ArrayList<ItemAuction> stack = new ArrayList<>(auctions.size());
|
||||
@@ -383,7 +383,7 @@ public final class ItemAuctionInstance
|
||||
{
|
||||
private final ItemAuction _auction;
|
||||
|
||||
public ScheduleAuctionTask(final ItemAuction auction)
|
||||
public ScheduleAuctionTask(ItemAuction auction)
|
||||
{
|
||||
_auction = auction;
|
||||
}
|
||||
@@ -479,7 +479,7 @@ public final class ItemAuctionInstance
|
||||
}
|
||||
}
|
||||
|
||||
final void onAuctionFinished(final ItemAuction auction)
|
||||
final void onAuctionFinished(ItemAuction auction)
|
||||
{
|
||||
auction.broadcastToAllBiddersInternal(SystemMessage.getSystemMessage(SystemMessageId.S1_S_AUCTION_HAS_ENDED).addInt(auction.getAuctionId()));
|
||||
|
||||
@@ -514,7 +514,7 @@ public final class ItemAuctionInstance
|
||||
}
|
||||
}
|
||||
|
||||
final void setStateTask(final ScheduledFuture<?> future)
|
||||
final void setStateTask(ScheduledFuture<?> future)
|
||||
{
|
||||
final ScheduledFuture<?> stateTask = _stateTask;
|
||||
if (stateTask != null)
|
||||
@@ -525,7 +525,7 @@ public final class ItemAuctionInstance
|
||||
_stateTask = future;
|
||||
}
|
||||
|
||||
private final ItemAuction createAuction(final long after)
|
||||
private final ItemAuction createAuction(long after)
|
||||
{
|
||||
final AuctionItem auctionItem = _items.get(Rnd.get(_items.size()));
|
||||
final long startingTime = _dateGenerator.nextDate(after);
|
||||
@@ -535,7 +535,7 @@ public final class ItemAuctionInstance
|
||||
return auction;
|
||||
}
|
||||
|
||||
private final ItemAuction loadAuction(final int auctionId) throws SQLException
|
||||
private final ItemAuction loadAuction(int auctionId) throws SQLException
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ public enum ItemAuctionState
|
||||
|
||||
private final byte _stateId;
|
||||
|
||||
private ItemAuctionState(final byte stateId)
|
||||
private ItemAuctionState(byte stateId)
|
||||
{
|
||||
_stateId = stateId;
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public enum ItemAuctionState
|
||||
return _stateId;
|
||||
}
|
||||
|
||||
public static final ItemAuctionState stateForStateId(final byte stateId)
|
||||
public static final ItemAuctionState stateForStateId(byte stateId)
|
||||
{
|
||||
for (ItemAuctionState state : ItemAuctionState.values())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user