Replaced instanceof L2Character with isCharacter method.

This commit is contained in:
MobiusDev
2018-06-30 16:42:41 +00:00
parent d806ff66e5
commit 049a9b02aa
179 changed files with 270 additions and 282 deletions

View File

@ -700,7 +700,7 @@ public abstract class AbstractAI implements Ctrl
public boolean isFollowing()
{
return (_target instanceof L2Character) && (_intention == AI_INTENTION_FOLLOW);
return (_target != null) && _target.isCharacter() && (_intention == AI_INTENTION_FOLLOW);
}
/**

View File

@ -487,7 +487,7 @@ public class GeoEngine
// get origin and target height, real height = collision height * 2
double oheight = 0;
if (origin instanceof L2Character)
if (origin.isCharacter())
{
oheight = ((L2Character) origin).getTemplate().getCollisionHeight();
}

View File

@ -126,7 +126,7 @@ public final class ZoneManager implements IGameXmlReader
// Re-validate all characters in zones
for (L2Object obj : L2World.getInstance().getVisibleObjects())
{
if (obj instanceof L2Character)
if (obj.isCharacter())
{
((L2Character) obj).revalidateZone(true);
}

View File

@ -194,7 +194,7 @@ public class L2CommandChannel extends AbstractPlayerGroup
*/
public boolean meetRaidWarCondition(L2Object obj)
{
if (!((obj instanceof L2Character) && ((L2Character) obj).isRaid()))
if (!(obj.isCharacter() && ((L2Character) obj).isRaid()))
{
return false;
}

View File

@ -4676,7 +4676,7 @@ public final class L2PcInstance extends L2Playable
oldTarget.removeStatusListener(this);
}
if (newTarget instanceof L2Character)
if ((newTarget != null) && newTarget.isCharacter())
{
final L2Character target = (L2Character) newTarget;

View File

@ -800,7 +800,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
return true;
}
final L2Character target = (object instanceof L2Character) ? (L2Character) object : null;
final L2Character target = object.isCharacter() ? (L2Character) object : null;
for (Condition preCondition : _preConditions)
{
if (preCondition == null)

View File

@ -588,7 +588,7 @@ public class SkillCaster implements Runnable
{
for (L2Object obj : targets)
{
if (!(obj instanceof L2Character))
if (!obj.isCharacter())
{
continue;
}

View File

@ -49,7 +49,7 @@ public class DamageFormatter extends Formatter
if (p instanceof L2Character)
{
if ((p instanceof L2Character) && ((L2Character) p).isRaid())
if (((L2Character) p).isRaid())
{
StringUtil.append(output, "RaidBoss ");
}