Use of isEmpty method when possible.
This commit is contained in:
@@ -446,7 +446,7 @@ public class Attackable extends Npc
|
||||
|
||||
final PartyContainer mostDamageParty;
|
||||
damagingParties.sort(Comparator.comparingLong(c -> c.damage));
|
||||
mostDamageParty = damagingParties.size() > 0 ? damagingParties.get(0) : null;
|
||||
mostDamageParty = !damagingParties.isEmpty() ? damagingParties.get(0) : null;
|
||||
|
||||
// Calculate raidboss points
|
||||
if (_isRaid && !_isRaidMinion)
|
||||
|
@@ -388,7 +388,7 @@ public class RequestAcquireSkill implements IClientIncomingPacket
|
||||
}
|
||||
|
||||
final List<SkillLearn> skills = SkillTreeData.getInstance().getAvailableRevelationSkills(player, SubclassType.BASECLASS);
|
||||
if (skills.size() > 0)
|
||||
if (!skills.isEmpty())
|
||||
{
|
||||
player.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION));
|
||||
}
|
||||
@@ -438,7 +438,7 @@ public class RequestAcquireSkill implements IClientIncomingPacket
|
||||
}
|
||||
|
||||
final List<SkillLearn> skills = SkillTreeData.getInstance().getAvailableRevelationSkills(player, SubclassType.DUALCLASS);
|
||||
if (skills.size() > 0)
|
||||
if (!skills.isEmpty())
|
||||
{
|
||||
player.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION_DUALCLASS));
|
||||
}
|
||||
|
@@ -129,7 +129,7 @@ public class RequestLuckyGamePlay implements IClientIncomingPacket
|
||||
final int totalWeight = rewards.values().stream().mapToInt(list -> list.stream().mapToInt(item -> ItemTable.getInstance().getTemplate(item.getId()).getWeight()).sum()).sum();
|
||||
|
||||
// Check inventory capacity
|
||||
if ((rewards.size() > 0) && (!player.getInventory().validateCapacity(rewards.size()) || !player.getInventory().validateWeight(totalWeight)))
|
||||
if (!rewards.isEmpty() && (!player.getInventory().validateCapacity(rewards.size()) || !player.getInventory().validateWeight(totalWeight)))
|
||||
{
|
||||
player.sendPacket(_type == LuckyGameType.LUXURY ? ExBettingLuckyGameResult.LUXURY_INVALID_CAPACITY : ExBettingLuckyGameResult.NORMAL_INVALID_CAPACITY);
|
||||
player.sendPacket(SystemMessageId.YOUR_INVENTORY_IS_EITHER_FULL_OR_OVERWEIGHT);
|
||||
|
@@ -47,7 +47,7 @@ public class ExOlympiadHeroAndLegendInfo implements IClientOutgoingPacket
|
||||
{
|
||||
OutgoingPackets.EX_OLYMPIAD_HERO_AND_LEGEND_INFO.writeId(packet);
|
||||
|
||||
if (Hero.getInstance().getHeroes().size() > 0)
|
||||
if (!Hero.getInstance().getHeroes().isEmpty())
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(GET_HEROES))
|
||||
|
@@ -66,7 +66,7 @@ public class ExOlympiadRankingInfo implements IClientOutgoingPacket
|
||||
packet.writeD(_serverId); // 0 - all servers, server id - for caller server
|
||||
packet.writeD(933); // unk, 933 all time
|
||||
|
||||
if (_playerList.size() > 0)
|
||||
if (!_playerList.isEmpty())
|
||||
{
|
||||
switch (_tabId)
|
||||
{
|
||||
@@ -83,7 +83,7 @@ public class ExOlympiadRankingInfo implements IClientOutgoingPacket
|
||||
packet.writeString(player.getString("clanName")); // clan name
|
||||
packet.writeD(id); // rank
|
||||
|
||||
if (_snapshotList.size() > 0)
|
||||
if (!_snapshotList.isEmpty())
|
||||
{
|
||||
for (Integer id2 : _snapshotList.keySet())
|
||||
{
|
||||
@@ -137,7 +137,7 @@ public class ExOlympiadRankingInfo implements IClientOutgoingPacket
|
||||
packet.writeString(plr.getString("name"));
|
||||
packet.writeString(plr.getString("clanName"));
|
||||
packet.writeD(id2);
|
||||
if (_snapshotList.size() > 0)
|
||||
if (!_snapshotList.isEmpty())
|
||||
{
|
||||
for (Integer id3 : _snapshotList.keySet())
|
||||
{
|
||||
@@ -196,7 +196,7 @@ public class ExOlympiadRankingInfo implements IClientOutgoingPacket
|
||||
packet.writeString(player.getString("name"));
|
||||
packet.writeString(player.getString("clanName"));
|
||||
packet.writeD(i); // class rank
|
||||
if (_snapshotList.size() > 0)
|
||||
if (!_snapshotList.isEmpty())
|
||||
{
|
||||
final Map<Integer, StatSet> snapshotRaceList = new ConcurrentHashMap<>();
|
||||
int j = 1;
|
||||
|
@@ -49,7 +49,7 @@ public class ExRankingCharInfo implements IClientOutgoingPacket
|
||||
{
|
||||
OutgoingPackets.EX_RANKING_CHAR_INFO.writeId(packet);
|
||||
|
||||
if (_playerList.size() > 0)
|
||||
if (!_playerList.isEmpty())
|
||||
{
|
||||
for (Integer id : _playerList.keySet())
|
||||
{
|
||||
|
@@ -60,7 +60,7 @@ public class ExRankingCharRankers implements IClientOutgoingPacket
|
||||
packet.writeC(_scope);
|
||||
packet.writeD(_race);
|
||||
|
||||
if (_playerList.size() > 0)
|
||||
if (!_playerList.isEmpty())
|
||||
{
|
||||
switch (_group)
|
||||
{
|
||||
@@ -80,7 +80,7 @@ public class ExRankingCharRankers implements IClientOutgoingPacket
|
||||
packet.writeD(player.getInt("classId"));
|
||||
packet.writeD(player.getInt("race"));
|
||||
packet.writeD(id); // server rank
|
||||
if (_snapshotList.size() > 0)
|
||||
if (!_snapshotList.isEmpty())
|
||||
{
|
||||
for (Integer id2 : _snapshotList.keySet())
|
||||
{
|
||||
@@ -128,7 +128,7 @@ public class ExRankingCharRankers implements IClientOutgoingPacket
|
||||
packet.writeD(plr.getInt("race"));
|
||||
packet.writeD(id2); // server rank
|
||||
|
||||
if (_snapshotList.size() > 0)
|
||||
if (!_snapshotList.isEmpty())
|
||||
{
|
||||
for (Integer id3 : _snapshotList.keySet())
|
||||
{
|
||||
@@ -177,7 +177,7 @@ public class ExRankingCharRankers implements IClientOutgoingPacket
|
||||
packet.writeD(player.getInt("classId"));
|
||||
packet.writeD(player.getInt("race"));
|
||||
packet.writeD(i); // server rank
|
||||
if (_snapshotList.size() > 0)
|
||||
if (!_snapshotList.isEmpty())
|
||||
{
|
||||
final Map<Integer, StatSet> snapshotRaceList = new ConcurrentHashMap<>();
|
||||
int j = 1;
|
||||
@@ -289,7 +289,7 @@ public class ExRankingCharRankers implements IClientOutgoingPacket
|
||||
packet.writeD(player.getInt("classId"));
|
||||
packet.writeD(player.getInt("race"));
|
||||
packet.writeD(id); // clan rank
|
||||
if (_snapshotList.size() > 0)
|
||||
if (!_snapshotList.isEmpty())
|
||||
{
|
||||
for (Integer id2 : _snapshotList.keySet())
|
||||
{
|
||||
@@ -316,7 +316,7 @@ public class ExRankingCharRankers implements IClientOutgoingPacket
|
||||
}
|
||||
case 3: // friend
|
||||
{
|
||||
if (_player.getFriendList().size() > 0)
|
||||
if (!_player.getFriendList().isEmpty())
|
||||
{
|
||||
final Set<Integer> friendList = ConcurrentHashMap.newKeySet();
|
||||
int count = 1;
|
||||
@@ -347,7 +347,7 @@ public class ExRankingCharRankers implements IClientOutgoingPacket
|
||||
packet.writeD(player.getInt("classId"));
|
||||
packet.writeD(player.getInt("race"));
|
||||
packet.writeD(id); // friend rank
|
||||
if (_snapshotList.size() > 0)
|
||||
if (!_snapshotList.isEmpty())
|
||||
{
|
||||
for (Integer id2 : _snapshotList.keySet())
|
||||
{
|
||||
@@ -384,7 +384,7 @@ public class ExRankingCharRankers implements IClientOutgoingPacket
|
||||
packet.writeD(_player.getBaseClass());
|
||||
packet.writeD(_player.getRace().ordinal());
|
||||
packet.writeD(1); // clan rank
|
||||
if (_snapshotList.size() > 0)
|
||||
if (!_snapshotList.isEmpty())
|
||||
{
|
||||
for (Integer id : _snapshotList.keySet())
|
||||
{
|
||||
|
Reference in New Issue
Block a user