Use of isEmpty method when possible.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user