Use of isEmpty method when possible.

This commit is contained in:
MobiusDevelopment
2021-05-25 02:32:37 +00:00
parent b88e59b956
commit bf4066d68e
141 changed files with 210 additions and 213 deletions
@@ -454,7 +454,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)
@@ -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);
@@ -447,7 +447,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)
@@ -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);
@@ -447,7 +447,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)
@@ -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);
@@ -447,7 +447,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)
@@ -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);
@@ -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)
@@ -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);
@@ -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)
@@ -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);
@@ -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)
@@ -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);
@@ -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())
{
@@ -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))
@@ -72,7 +72,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())
{
final RankingOlympiadCategory category = RankingOlympiadCategory.values()[_tabId];
writeFilteredRankingData(packet, category, category.getScopeByGroup(_rankingType), ClassId.getClassId(_classId));
@@ -144,7 +144,7 @@ public class ExOlympiadRankingInfo implements IClientOutgoingPacket
packet.writeString(player.getString("clanName")); // clan name
packet.writeD(scope == RankingOlympiadScope.SELF ? data.getKey() : curRank); // rank
if (snapshot.size() > 0)
if (!snapshot.isEmpty())
{
int snapshotRank = 1;
for (Entry<Integer, StatSet> ssData : snapshot.stream().sorted(Entry.comparingByKey()).collect(Collectors.toList()))
@@ -65,7 +65,7 @@ public class ExPvpRankingList implements IClientOutgoingPacket
packet.writeC(_tabId);
packet.writeC(_type);
packet.writeD(_race);
if ((_playerList.size() > 0) && (_type != 255) && (_race != 255))
if (!_playerList.isEmpty() && (_type != 255) && (_race != 255))
{
final RankingCategory category = RankingCategory.values()[_tabId];
writeFilteredRankingData(packet, category, category.getScopeByGroup(_type), Race.values()[_race]);
@@ -152,7 +152,7 @@ public class ExPvpRankingList implements IClientOutgoingPacket
packet.writeD(player.getInt("race"));
packet.writeD(player.getInt("classId"));
packet.writeQ(player.getInt("points")); // server rank
if (snapshot.size() > 0)
if (!snapshot.isEmpty())
{
for (Entry<Integer, StatSet> ssData : snapshot.stream().sorted(Entry.comparingByKey()).collect(Collectors.toList()))
{
@@ -46,7 +46,7 @@ public class ExPvpRankingMyInfo implements IClientOutgoingPacket
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_PVP_RANKING_MY_INFO.writeId(packet);
if (_playerList.size() > 0)
if (!_playerList.isEmpty())
{
boolean found = false;
for (Integer id : _playerList.keySet())
@@ -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())
{
@@ -66,7 +66,7 @@ public class ExRankingCharRankers implements IClientOutgoingPacket
packet.writeD(_ordinal);
packet.writeD(_player.getClassId().getId());
if (_playerList.size() > 0)
if (!_playerList.isEmpty())
{
final RankingCategory category = RankingCategory.values()[_group];
writeFilteredRankingData(packet, category, category.getScopeByGroup(_scope));
@@ -159,7 +159,7 @@ public class ExRankingCharRankers implements IClientOutgoingPacket
packet.writeD(player.getInt("classId"));
packet.writeD(player.getInt("race"));
packet.writeD(scope == RankingScope.SELF ? data.getKey() : curRank); // server rank
if (snapshot.size() > 0)
if (!snapshot.isEmpty())
{
int snapshotRank = 1;
for (Entry<Integer, StatSet> ssData : snapshot.stream().sorted(Entry.comparingByKey()).collect(Collectors.toList()))
@@ -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))
@@ -72,7 +72,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())
{
final RankingOlympiadCategory category = RankingOlympiadCategory.values()[_tabId];
writeFilteredRankingData(packet, category, category.getScopeByGroup(_rankingType), ClassId.getClassId(_classId));
@@ -144,7 +144,7 @@ public class ExOlympiadRankingInfo implements IClientOutgoingPacket
packet.writeString(player.getString("clanName")); // clan name
packet.writeD(scope == RankingOlympiadScope.SELF ? data.getKey() : curRank); // rank
if (snapshot.size() > 0)
if (!snapshot.isEmpty())
{
int snapshotRank = 1;
for (Entry<Integer, StatSet> ssData : snapshot.stream().sorted(Entry.comparingByKey()).collect(Collectors.toList()))
@@ -65,7 +65,7 @@ public class ExPvpRankingList implements IClientOutgoingPacket
packet.writeC(_tabId);
packet.writeC(_type);
packet.writeD(_race);
if ((_playerList.size() > 0) && (_type != 255) && (_race != 255))
if (!_playerList.isEmpty() && (_type != 255) && (_race != 255))
{
final RankingCategory category = RankingCategory.values()[_tabId];
writeFilteredRankingData(packet, category, category.getScopeByGroup(_type), Race.values()[_race]);
@@ -152,7 +152,7 @@ public class ExPvpRankingList implements IClientOutgoingPacket
packet.writeD(player.getInt("race"));
packet.writeD(player.getInt("classId"));
packet.writeQ(player.getInt("points")); // server rank
if (snapshot.size() > 0)
if (!snapshot.isEmpty())
{
for (Entry<Integer, StatSet> ssData : snapshot.stream().sorted(Entry.comparingByKey()).collect(Collectors.toList()))
{
@@ -46,7 +46,7 @@ public class ExPvpRankingMyInfo implements IClientOutgoingPacket
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_PVP_RANKING_MY_INFO.writeId(packet);
if (_playerList.size() > 0)
if (!_playerList.isEmpty())
{
boolean found = false;
for (Integer id : _playerList.keySet())
@@ -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())
{
@@ -66,7 +66,7 @@ public class ExRankingCharRankers implements IClientOutgoingPacket
packet.writeD(_ordinal);
packet.writeD(_player.getClassId().getId());
if (_playerList.size() > 0)
if (!_playerList.isEmpty())
{
final RankingCategory category = RankingCategory.values()[_group];
writeFilteredRankingData(packet, category, category.getScopeByGroup(_scope));
@@ -159,7 +159,7 @@ public class ExRankingCharRankers implements IClientOutgoingPacket
packet.writeD(player.getInt("classId"));
packet.writeD(player.getInt("race"));
packet.writeD(scope == RankingScope.SELF ? data.getKey() : curRank); // server rank
if (snapshot.size() > 0)
if (!snapshot.isEmpty())
{
int snapshotRank = 1;
for (Entry<Integer, StatSet> ssData : snapshot.stream().sorted(Entry.comparingByKey()).collect(Collectors.toList()))
@@ -378,7 +378,7 @@ public class GameServer
printSection("Quests");
if (!Config.ALT_DEV_NO_QUESTS)
{
if (QuestManager.getInstance().getQuests().size() == 0)
if (QuestManager.getInstance().getQuests().isEmpty())
{
QuestManager.getInstance().reloadAllQuests();
}
@@ -330,7 +330,7 @@ public class AttackableAI extends CreatureAI
final Attackable npc = getActiveChar();
// If its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE
if (npc.getKnownList().getKnownPlayers().size() > 0)
if (!npc.getKnownList().getKnownPlayers().isEmpty())
{
intention = AI_INTENTION_ACTIVE;
}
@@ -218,7 +218,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
final Attackable npc = (Attackable) _actor;
// If its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE
if (npc.getKnownList().getKnownPlayers().size() > 0)
if (!npc.getKnownList().getKnownPlayers().isEmpty())
{
intention = AI_INTENTION_ACTIVE;
}
@@ -168,7 +168,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
final Attackable npc = (Attackable) _actor;
// If its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE
if (npc.getKnownList().getKnownPlayers().size() > 0)
if (!npc.getKnownList().getKnownPlayers().isEmpty())
{
intention = AI_INTENTION_ACTIVE;
}
@@ -503,7 +503,7 @@ public class Disablers implements ISkillHandler
}
}
}
if ((Config.RESTORE_CANCELLED_BUFFS_SECONDS > 0) && (cancelledBuffs.size() > 0))
if ((Config.RESTORE_CANCELLED_BUFFS_SECONDS > 0) && !cancelledBuffs.isEmpty())
{
ThreadPool.schedule(new CancelSkillRestoreTask((PlayerInstance) target, cancelledBuffs), Config.RESTORE_CANCELLED_BUFFS_SECONDS * 1000);
}
@@ -525,7 +525,7 @@ public class PetitionManager
{
final StringBuilder htmlContent = new StringBuilder("<html><body><center><font color=\"LEVEL\">Current Petitions</font><br><table width=\"300\">");
final SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMM HH:mm z");
if (_pendingPetitions.size() == 0)
if (_pendingPetitions.isEmpty())
{
htmlContent.append("<tr><td colspan=\"4\">There are no currently pending petitions.</td></tr>");
}
@@ -201,7 +201,7 @@ public class MobGroup
{
removeDead();
if (getMobs().size() == 0)
if (getMobs().isEmpty())
{
return null;
}
@@ -214,7 +214,7 @@ public class MobGroup
{
removeDead();
if (getMobs().size() == 0)
if (getMobs().isEmpty())
{
return;
}
@@ -6649,7 +6649,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
}
}
if (_chanceSkills.size() == 0)
if (_chanceSkills.isEmpty())
{
_chanceSkills = null;
}
@@ -132,7 +132,7 @@ public class ClassMasterInstance extends FolkInstance
}
}
if ((Config.CLASS_MASTER_SETTINGS.getRequireItems(jobLevel) != null) && (Config.CLASS_MASTER_SETTINGS.getRequireItems(jobLevel).size() > 0))
if ((Config.CLASS_MASTER_SETTINGS.getRequireItems(jobLevel) != null) && !Config.CLASS_MASTER_SETTINGS.getRequireItems(jobLevel).isEmpty())
{
sb.append("<br><br>Item(s) required for class change:");
sb.append("<table width=220>");
@@ -9799,7 +9799,7 @@ public class PlayerInstance extends Playable
}
// Triggered skills cannot be used directly
if ((_triggeredSkills.size() > 0) && (_triggeredSkills.get(skill.getId()) != null))
if (!_triggeredSkills.isEmpty() && (_triggeredSkills.get(skill.getId()) != null))
{
sendPacket(ActionFailed.STATIC_PACKET);
return;
@@ -10570,7 +10570,7 @@ public class PlayerInstance extends Playable
public void unsummonAllCubics()
{
// Unsummon Cubics
if (_cubics.size() > 0)
if (!_cubics.isEmpty())
{
for (CubicInstance cubic : _cubics.values())
{
@@ -10691,7 +10691,7 @@ public class PlayerInstance extends Playable
{
ItemInstance item;
IItemHandler handler;
if ((_activeSoulShots == null) || (_activeSoulShots.size() == 0))
if ((_activeSoulShots == null) || (_activeSoulShots.isEmpty()))
{
return;
}
@@ -171,7 +171,7 @@ public class WarehouseInstance extends FolkInstance
private void showDepositWindowFreight(PlayerInstance player)
{
// No other chars in the account of this player
if (player.getAccountChars().size() == 0)
if (player.getAccountChars().isEmpty())
{
player.sendPacket(SystemMessageId.THAT_CHARACTER_DOES_NOT_EXIST);
}
@@ -65,10 +65,10 @@ public class CreatureStat
}
final int id = stat.ordinal();
final Calculator c = _creature.getCalculators()[id];
final Calculator calc = _creature.getCalculators()[id];
// If no Func object found, no modifier is applied
if ((c == null) || (c.size() == 0))
if ((calc == null) || (calc.size() == 0))
{
return init;
}
@@ -82,7 +82,7 @@ public class CreatureStat
env.baseValue = init;
// Launch the calculation
c.calc(env);
calc.calc(env);
// avoid some troubles with negative stats (some stats should never be negative)
if (env.value <= 0)
{
@@ -76,7 +76,7 @@ public class BanditStrongholdSiege extends ClanHallSiege
public void startSiege()
{
setRegistrationPeriod(false);
if (_clansInfo.size() == 0)
if (_clansInfo.isEmpty())
{
endSiege(false);
return;
@@ -73,7 +73,7 @@ public class WildBeastFarmSiege extends ClanHallSiege
public void startSiege()
{
setRegistrationPeriod(false);
if (_clansInfo.size() == 0)
if (_clansInfo.isEmpty())
{
endSiege(false);
return;
@@ -62,8 +62,6 @@ public class FriendList implements IClientOutgoingPacket
public boolean write(PacketWriter packet)
{
OutgoingPackets.FRIEND_LIST.writeId(packet);
if (_info.size() > 0)
{
packet.writeH(_info.size());
for (FriendInfo friend : _info)
{
@@ -73,7 +71,6 @@ public class FriendList implements IClientOutgoingPacket
packet.writeD(friend._online ? 0x01 : 0x00);
packet.writeH(0); // ??
}
}
return true;
}
}
@@ -390,7 +390,7 @@ public class GameServer
printSection("Quests");
if (!Config.ALT_DEV_NO_QUESTS)
{
if (QuestManager.getInstance().getQuests().size() == 0)
if (QuestManager.getInstance().getQuests().isEmpty())
{
QuestManager.getInstance().reloadAllQuests();
}
@@ -330,7 +330,7 @@ public class AttackableAI extends CreatureAI
final Attackable npc = getActiveChar();
// If its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE
if (npc.getKnownList().getKnownPlayers().size() > 0)
if (!npc.getKnownList().getKnownPlayers().isEmpty())
{
intention = AI_INTENTION_ACTIVE;
}
@@ -218,7 +218,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
final Attackable npc = (Attackable) _actor;
// If its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE
if (npc.getKnownList().getKnownPlayers().size() > 0)
if (!npc.getKnownList().getKnownPlayers().isEmpty())
{
intention = AI_INTENTION_ACTIVE;
}
@@ -168,7 +168,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
final Attackable npc = (Attackable) _actor;
// If its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE
if (npc.getKnownList().getKnownPlayers().size() > 0)
if (!npc.getKnownList().getKnownPlayers().isEmpty())
{
intention = AI_INTENTION_ACTIVE;
}
@@ -503,7 +503,7 @@ public class Disablers implements ISkillHandler
}
}
}
if ((Config.RESTORE_CANCELLED_BUFFS_SECONDS > 0) && (cancelledBuffs.size() > 0))
if ((Config.RESTORE_CANCELLED_BUFFS_SECONDS > 0) && !cancelledBuffs.isEmpty())
{
ThreadPool.schedule(new CancelSkillRestoreTask((PlayerInstance) target, cancelledBuffs), Config.RESTORE_CANCELLED_BUFFS_SECONDS * 1000);
}
@@ -525,7 +525,7 @@ public class PetitionManager
{
final StringBuilder htmlContent = new StringBuilder("<html><body><center><font color=\"LEVEL\">Current Petitions</font><br><table width=\"300\">");
final SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMM HH:mm z");
if (_pendingPetitions.size() == 0)
if (_pendingPetitions.isEmpty())
{
htmlContent.append("<tr><td colspan=\"4\">There are no currently pending petitions.</td></tr>");
}
@@ -201,7 +201,7 @@ public class MobGroup
{
removeDead();
if (getMobs().size() == 0)
if (getMobs().isEmpty())
{
return null;
}
@@ -214,7 +214,7 @@ public class MobGroup
{
removeDead();
if (getMobs().size() == 0)
if (getMobs().isEmpty())
{
return;
}
@@ -6696,7 +6696,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
}
}
if (_chanceSkills.size() == 0)
if (_chanceSkills.isEmpty())
{
_chanceSkills = null;
}
@@ -132,7 +132,7 @@ public class ClassMasterInstance extends FolkInstance
}
}
if ((Config.CLASS_MASTER_SETTINGS.getRequireItems(jobLevel) != null) && (Config.CLASS_MASTER_SETTINGS.getRequireItems(jobLevel).size() > 0))
if ((Config.CLASS_MASTER_SETTINGS.getRequireItems(jobLevel) != null) && !Config.CLASS_MASTER_SETTINGS.getRequireItems(jobLevel).isEmpty())
{
sb.append("<br><br>Item(s) required for class change:");
sb.append("<table width=220>");
@@ -9961,7 +9961,7 @@ public class PlayerInstance extends Playable
}
// Triggered skills cannot be used directly
if ((_triggeredSkills.size() > 0) && (_triggeredSkills.get(skill.getId()) != null))
if (!_triggeredSkills.isEmpty() && (_triggeredSkills.get(skill.getId()) != null))
{
sendPacket(ActionFailed.STATIC_PACKET);
return;
@@ -10742,7 +10742,7 @@ public class PlayerInstance extends Playable
public void unsummonAllCubics()
{
// Unsummon Cubics
if (_cubics.size() > 0)
if (!_cubics.isEmpty())
{
for (CubicInstance cubic : _cubics.values())
{
@@ -10863,7 +10863,7 @@ public class PlayerInstance extends Playable
{
ItemInstance item;
IItemHandler handler;
if ((_activeSoulShots == null) || (_activeSoulShots.size() == 0))
if ((_activeSoulShots == null) || (_activeSoulShots.isEmpty()))
{
return;
}
@@ -171,7 +171,7 @@ public class WarehouseInstance extends FolkInstance
private void showDepositWindowFreight(PlayerInstance player)
{
// No other chars in the account of this player
if (player.getAccountChars().size() == 0)
if (player.getAccountChars().isEmpty())
{
player.sendPacket(SystemMessageId.THAT_CHARACTER_DOES_NOT_EXIST);
}
@@ -65,10 +65,10 @@ public class CreatureStat
}
final int id = stat.ordinal();
final Calculator c = _creature.getCalculators()[id];
final Calculator calc = _creature.getCalculators()[id];
// If no Func object found, no modifier is applied
if ((c == null) || (c.size() == 0))
if ((calc == null) || (calc.size() == 0))
{
return init;
}
@@ -82,7 +82,7 @@ public class CreatureStat
env.baseValue = init;
// Launch the calculation
c.calc(env);
calc.calc(env);
// avoid some troubles with negative stats (some stats should never be negative)
if (env.value <= 0)
{
@@ -76,7 +76,7 @@ public class BanditStrongholdSiege extends ClanHallSiege
public void startSiege()
{
setRegistrationPeriod(false);
if (_clansInfo.size() == 0)
if (_clansInfo.isEmpty())
{
endSiege(false);
return;
@@ -73,7 +73,7 @@ public class WildBeastFarmSiege extends ClanHallSiege
public void startSiege()
{
setRegistrationPeriod(false);
if (_clansInfo.size() == 0)
if (_clansInfo.isEmpty())
{
endSiege(false);
return;
@@ -63,12 +63,12 @@ public class FriendList implements IClientOutgoingPacket
{
OutgoingPackets.FRIEND_LIST.writeId(packet);
packet.writeD(_info.size());
for (FriendInfo info : _info)
for (FriendInfo friend : _info)
{
packet.writeD(info._objId);
packet.writeS(info._name);
packet.writeD(info._online ? 0x01 : 0x00);
packet.writeD(info._online ? info._objId : 0x00);
packet.writeD(friend._objId);
packet.writeS(friend._name);
packet.writeD(friend._online ? 0x01 : 0x00);
packet.writeD(friend._online ? friend._objId : 0x00);
}
return true;
}
@@ -562,7 +562,7 @@ public abstract class FlagWar extends ClanHallSiegeEngine
@Override
public void onSiegeEnds()
{
if (_data.size() > 0)
if (!_data.isEmpty())
{
for (int clanId : _data.keySet())
{
@@ -476,7 +476,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;
// Manage Base, Quests and Sweep drops of the Attackable
if ((mostDamageParty != null) && (mostDamageParty.damage > maxDamage))
@@ -86,10 +86,10 @@ public class CreatureStat
}
final int id = stat.ordinal();
final Calculator c = _creature.getCalculators()[id];
final Calculator calc = _creature.getCalculators()[id];
// If no Func object found, no modifier is applied
if ((c == null) || (c.size() == 0))
if ((calc == null) || (calc.size() == 0))
{
return value;
}
@@ -106,7 +106,7 @@ public class CreatureStat
}
// Launch the calculation
value = c.calc(_creature, target, skill, value);
value = calc.calc(_creature, target, skill, value);
// avoid some troubles with negative stats (some stats should never be negative)
if (value <= 0)
@@ -121,7 +121,7 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
ps.setInt(1, _hall.getId());
ps.execute();
if (_attackers.size() > 0)
if (!_attackers.isEmpty())
{
try (PreparedStatement insert = con.prepareStatement(SQL_SAVE_ATTACKERS))
{
@@ -43,7 +43,7 @@ public class GmViewQuestInfo implements IClientOutgoingPacket
packet.writeS(_player.getName());
final List<Quest> questList = _player.getAllActiveQuests();
if (questList.size() == 0)
if (questList.isEmpty())
{
packet.writeC(0);
packet.writeH(0);
@@ -562,7 +562,7 @@ public abstract class FlagWar extends ClanHallSiegeEngine
@Override
public void onSiegeEnds()
{
if (_data.size() > 0)
if (!_data.isEmpty())
{
for (int clanId : _data.keySet())
{
@@ -476,7 +476,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;
// Manage Base, Quests and Sweep drops of the Attackable
if ((mostDamageParty != null) && (mostDamageParty.damage > maxDamage))
@@ -86,10 +86,10 @@ public class CreatureStat
}
final int id = stat.ordinal();
final Calculator c = _creature.getCalculators()[id];
final Calculator calc = _creature.getCalculators()[id];
// If no Func object found, no modifier is applied
if ((c == null) || (c.size() == 0))
if ((calc == null) || (calc.size() == 0))
{
return value;
}
@@ -106,7 +106,7 @@ public class CreatureStat
}
// Launch the calculation
value = c.calc(_creature, target, skill, value);
value = calc.calc(_creature, target, skill, value);
// avoid some troubles with negative stats (some stats should never be negative)
if (value <= 0)
@@ -121,7 +121,7 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
ps.setInt(1, _hall.getId());
ps.execute();
if (_attackers.size() > 0)
if (!_attackers.isEmpty())
{
try (PreparedStatement insert = con.prepareStatement(SQL_SAVE_ATTACKERS))
{
@@ -43,7 +43,7 @@ public class GmViewQuestInfo implements IClientOutgoingPacket
packet.writeS(_player.getName());
final List<Quest> questList = _player.getAllActiveQuests();
if (questList.size() == 0)
if (questList.isEmpty())
{
packet.writeC(0);
packet.writeH(0);
@@ -179,7 +179,7 @@ public class EnergyOfInsolence extends AbstractNpcAI
if (CommonUtil.contains(ENERGY_OF_INSOLENCE_MINIONS, npc.getId()))
{
final MonsterInstance leader = ((MonsterInstance) npc).getLeader();
if ((leader != null) && (leader.getMinionList().getSpawnedMinions().size() == 0) && !leader.isDead())
if ((leader != null) && (leader.getMinionList().getSpawnedMinions().isEmpty()) && !leader.isDead())
{
makeMortal(leader);
}
@@ -447,7 +447,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)
@@ -436,7 +436,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));
}
@@ -486,7 +486,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);
@@ -66,7 +66,7 @@ public class AcquireSkillList implements IClientOutgoingPacket
packet.writeQ(skill.getLevelUpSp());
packet.writeC(skill.getGetLevel());
packet.writeC(0x00); // Skill dual class level.
if (skill.getRequiredItems().size() > 0)
if (!skill.getRequiredItems().isEmpty())
{
for (ItemHolder item : skill.getRequiredItems())
{
@@ -179,7 +179,7 @@ public class EnergyOfInsolence extends AbstractNpcAI
if (CommonUtil.contains(ENERGY_OF_INSOLENCE_MINIONS, npc.getId()))
{
final MonsterInstance leader = ((MonsterInstance) npc).getLeader();
if ((leader != null) && (leader.getMinionList().getSpawnedMinions().size() == 0) && !leader.isDead())
if ((leader != null) && (leader.getMinionList().getSpawnedMinions().isEmpty()) && !leader.isDead())
{
makeMortal(leader);
}
@@ -447,7 +447,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)
@@ -436,7 +436,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));
}
@@ -486,7 +486,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);
@@ -66,7 +66,7 @@ public class AcquireSkillList implements IClientOutgoingPacket
packet.writeQ(skill.getLevelUpSp());
packet.writeC(skill.getGetLevel());
packet.writeC(0x00); // Skill dual class level.
if (skill.getRequiredItems().size() > 0)
if (!skill.getRequiredItems().isEmpty())
{
for (ItemHolder item : skill.getRequiredItems())
{
@@ -179,7 +179,7 @@ public class EnergyOfInsolence extends AbstractNpcAI
if (CommonUtil.contains(ENERGY_OF_INSOLENCE_MINIONS, npc.getId()))
{
final MonsterInstance leader = ((MonsterInstance) npc).getLeader();
if ((leader != null) && (leader.getMinionList().getSpawnedMinions().size() == 0) && !leader.isDead())
if ((leader != null) && (leader.getMinionList().getSpawnedMinions().isEmpty()) && !leader.isDead())
{
makeMortal(leader);
}
@@ -447,7 +447,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)
@@ -436,7 +436,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));
}
@@ -486,7 +486,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);
@@ -67,7 +67,7 @@ public class AcquireSkillList implements IClientOutgoingPacket
packet.writeC(skill.getGetLevel());
packet.writeC(0x00); // Skill dual class level.
packet.writeC(_player.getKnownSkill(skill.getSkillId()) != null ? 0x00 : 0x01);
if (skill.getRequiredItems().size() > 0)
if (!skill.getRequiredItems().isEmpty())
{
for (ItemHolder item : skill.getRequiredItems())
{
@@ -179,7 +179,7 @@ public class EnergyOfInsolence extends AbstractNpcAI
if (CommonUtil.contains(ENERGY_OF_INSOLENCE_MINIONS, npc.getId()))
{
final MonsterInstance leader = ((MonsterInstance) npc).getLeader();
if ((leader != null) && (leader.getMinionList().getSpawnedMinions().size() == 0) && !leader.isDead())
if ((leader != null) && (leader.getMinionList().getSpawnedMinions().isEmpty()) && !leader.isDead())
{
makeMortal(leader);
}
@@ -449,7 +449,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)
@@ -436,7 +436,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));
}
@@ -486,7 +486,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);
@@ -67,7 +67,7 @@ public class AcquireSkillList implements IClientOutgoingPacket
packet.writeC(skill.getGetLevel());
packet.writeC(0x00); // Skill dual class level.
packet.writeC(_player.getKnownSkill(skill.getSkillId()) != null ? 0x00 : 0x01);
if (skill.getRequiredItems().size() > 0)
if (!skill.getRequiredItems().isEmpty())
{
for (ItemHolder item : skill.getRequiredItems())
{
@@ -179,7 +179,7 @@ public class EnergyOfInsolence extends AbstractNpcAI
if (CommonUtil.contains(ENERGY_OF_INSOLENCE_MINIONS, npc.getId()))
{
final MonsterInstance leader = ((MonsterInstance) npc).getLeader();
if ((leader != null) && (leader.getMinionList().getSpawnedMinions().size() == 0) && !leader.isDead())
if ((leader != null) && (leader.getMinionList().getSpawnedMinions().isEmpty()) && !leader.isDead())
{
makeMortal(leader);
}

Some files were not shown because too many files have changed in this diff Show More