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

View File

@ -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)

View File

@ -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);