Replaced instanceof L2Playable with isPlayable method.

This commit is contained in:
MobiusDev 2018-07-02 00:39:38 +00:00
parent e7ac53ba66
commit 6c1d37f4ae
46 changed files with 62 additions and 79 deletions

View File

@ -51,7 +51,7 @@ public class AdminLevel implements IAdminCommandHandler
{
try
{
if (targetChar instanceof L2Playable)
if ((targetChar != null) && targetChar.isPlayable())
{
((L2Playable) targetChar).getStat().addLevel(Byte.parseByte(val));
}

View File

@ -26,7 +26,6 @@ import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.instance.L2BoatInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.serverpackets.AdminForgePacket;
@ -475,7 +474,7 @@ public final class AdminPForge implements IAdminCommandHandler
case "$tboid":
{
target = activeChar.getTarget();
if ((target != null) && (target instanceof L2Playable))
if ((target != null) && target.isPlayable())
{
boat = target.getActingPlayer().getBoat();
if (boat != null)

View File

@ -41,7 +41,7 @@ public abstract class L2PlayableAI extends L2CharacterAI
@Override
protected void onIntentionAttack(L2Character target)
{
if (target instanceof L2Playable)
if ((target != null) && target.isPlayable())
{
if (target.getActingPlayer().isProtectionBlessingAffected() && ((_actor.getActingPlayer().getLevel() - target.getActingPlayer().getLevel()) >= 10) && (_actor.getActingPlayer().getReputation() < 0) && !(target.isInsideZone(ZoneId.PVP)))
{

View File

@ -24,7 +24,6 @@ import com.l2jmobius.gameserver.instancemanager.FortManager;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jmobius.gameserver.model.entity.Castle;
import com.l2jmobius.gameserver.model.entity.Fort;
@ -60,7 +59,7 @@ public class L2DefenderInstance extends L2Attackable
public boolean isAutoAttackable(L2Character attacker)
{
// Attackable during siege by all except defenders
if (!(attacker instanceof L2Playable))
if (!attacker.isPlayable())
{
return false;
}

View File

@ -17,7 +17,6 @@
package com.l2jmobius.gameserver.model.conditions;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.skills.Skill;
@ -29,6 +28,6 @@ public class ConditionTargetPlayable extends Condition
@Override
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
{
return effected instanceof L2Playable;
return (effected != null) && effected.isPlayable();
}
}

View File

@ -51,7 +51,7 @@ public class AdminLevel implements IAdminCommandHandler
{
try
{
if (targetChar instanceof L2Playable)
if ((targetChar != null) && targetChar.isPlayable())
{
((L2Playable) targetChar).getStat().addLevel(Byte.parseByte(val));
}

View File

@ -26,7 +26,6 @@ import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.instance.L2BoatInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.serverpackets.AdminForgePacket;
@ -475,7 +474,7 @@ public final class AdminPForge implements IAdminCommandHandler
case "$tboid":
{
target = activeChar.getTarget();
if ((target != null) && (target instanceof L2Playable))
if ((target != null) && target.isPlayable())
{
boat = target.getActingPlayer().getBoat();
if (boat != null)

View File

@ -41,7 +41,7 @@ public abstract class L2PlayableAI extends L2CharacterAI
@Override
protected void onIntentionAttack(L2Character target)
{
if (target instanceof L2Playable)
if ((target != null) && target.isPlayable())
{
if (target.getActingPlayer().isProtectionBlessingAffected() && ((_actor.getActingPlayer().getLevel() - target.getActingPlayer().getLevel()) >= 10) && (_actor.getActingPlayer().getReputation() < 0) && !(target.isInsideZone(ZoneId.PVP)))
{

View File

@ -24,7 +24,6 @@ import com.l2jmobius.gameserver.instancemanager.FortManager;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jmobius.gameserver.model.entity.Castle;
import com.l2jmobius.gameserver.model.entity.Fort;
@ -60,7 +59,7 @@ public class L2DefenderInstance extends L2Attackable
public boolean isAutoAttackable(L2Character attacker)
{
// Attackable during siege by all except defenders
if (!(attacker instanceof L2Playable))
if (!attacker.isPlayable())
{
return false;
}

View File

@ -17,7 +17,6 @@
package com.l2jmobius.gameserver.model.conditions;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.skills.Skill;
@ -29,6 +28,6 @@ public class ConditionTargetPlayable extends Condition
@Override
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
{
return effected instanceof L2Playable;
return (effected != null) && effected.isPlayable();
}
}

View File

@ -51,7 +51,7 @@ public class AdminLevel implements IAdminCommandHandler
{
try
{
if (targetChar instanceof L2Playable)
if ((targetChar != null) && targetChar.isPlayable())
{
((L2Playable) targetChar).getStat().addLevel(Byte.parseByte(val));
}

View File

@ -26,7 +26,6 @@ import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.instance.L2BoatInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.serverpackets.AdminForgePacket;
@ -475,7 +474,7 @@ public final class AdminPForge implements IAdminCommandHandler
case "$tboid":
{
target = activeChar.getTarget();
if ((target != null) && (target instanceof L2Playable))
if ((target != null) && target.isPlayable())
{
boat = target.getActingPlayer().getBoat();
if (boat != null)

View File

@ -41,7 +41,7 @@ public abstract class L2PlayableAI extends L2CharacterAI
@Override
protected void onIntentionAttack(L2Character target)
{
if (target instanceof L2Playable)
if ((target != null) && target.isPlayable())
{
if (target.getActingPlayer().isProtectionBlessingAffected() && ((_actor.getActingPlayer().getLevel() - target.getActingPlayer().getLevel()) >= 10) && (_actor.getActingPlayer().getReputation() < 0) && !(target.isInsideZone(ZoneId.PVP)))
{

View File

@ -24,7 +24,6 @@ import com.l2jmobius.gameserver.instancemanager.FortManager;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jmobius.gameserver.model.entity.Castle;
import com.l2jmobius.gameserver.model.entity.Fort;
@ -60,7 +59,7 @@ public class L2DefenderInstance extends L2Attackable
public boolean isAutoAttackable(L2Character attacker)
{
// Attackable during siege by all except defenders
if (!(attacker instanceof L2Playable))
if (!attacker.isPlayable())
{
return false;
}

View File

@ -17,7 +17,6 @@
package com.l2jmobius.gameserver.model.conditions;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.skills.Skill;
@ -29,6 +28,6 @@ public class ConditionTargetPlayable extends Condition
@Override
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
{
return effected instanceof L2Playable;
return (effected != null) && effected.isPlayable();
}
}

View File

@ -51,7 +51,7 @@ public class AdminLevel implements IAdminCommandHandler
{
try
{
if (targetChar instanceof L2Playable)
if ((targetChar != null) && targetChar.isPlayable())
{
((L2Playable) targetChar).getStat().addLevel(Byte.parseByte(val));
}

View File

@ -26,7 +26,6 @@ import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.instance.L2BoatInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.serverpackets.AdminForgePacket;
@ -475,7 +474,7 @@ public final class AdminPForge implements IAdminCommandHandler
case "$tboid":
{
target = activeChar.getTarget();
if ((target != null) && (target instanceof L2Playable))
if ((target != null) && target.isPlayable())
{
boat = target.getActingPlayer().getBoat();
if (boat != null)

View File

@ -41,7 +41,7 @@ public abstract class L2PlayableAI extends L2CharacterAI
@Override
protected void onIntentionAttack(L2Character target)
{
if (target instanceof L2Playable)
if ((target != null) && target.isPlayable())
{
if (target.getActingPlayer().isProtectionBlessingAffected() && ((_actor.getActingPlayer().getLevel() - target.getActingPlayer().getLevel()) >= 10) && (_actor.getActingPlayer().getReputation() < 0) && !(target.isInsideZone(ZoneId.PVP)))
{

View File

@ -24,7 +24,6 @@ import com.l2jmobius.gameserver.instancemanager.FortManager;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jmobius.gameserver.model.entity.Castle;
import com.l2jmobius.gameserver.model.entity.Fort;
@ -60,7 +59,7 @@ public class L2DefenderInstance extends L2Attackable
public boolean isAutoAttackable(L2Character attacker)
{
// Attackable during siege by all except defenders
if (!(attacker instanceof L2Playable))
if (!attacker.isPlayable())
{
return false;
}

View File

@ -17,7 +17,6 @@
package com.l2jmobius.gameserver.model.conditions;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.skills.Skill;
@ -29,6 +28,6 @@ public class ConditionTargetPlayable extends Condition
@Override
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
{
return effected instanceof L2Playable;
return (effected != null) && effected.isPlayable();
}
}

View File

@ -51,7 +51,7 @@ public class AdminLevel implements IAdminCommandHandler
{
try
{
if (targetChar instanceof L2Playable)
if ((targetChar != null) && targetChar.isPlayable())
{
((L2Playable) targetChar).getStat().addLevel(Byte.parseByte(val));
}

View File

@ -475,7 +475,7 @@ public final class AdminPForge implements IAdminCommandHandler
case "$tboid":
{
target = activeChar.getTarget();
if ((target != null) && (target instanceof L2Playable))
if ((target != null) && target.isPlayable())
{
boat = ((L2Playable) target).getActingPlayer().getBoat();
if (boat != null)

View File

@ -123,11 +123,16 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
*/
private boolean autoAttackCondition(L2Character target)
{
if (target == null)
{
return false;
}
// Check if the target isn't another guard, folk or a door
if ((target == null) || (target instanceof L2DefenderInstance) || (target instanceof L2NpcInstance) || (target instanceof L2DoorInstance) || target.isAlikeDead() || (target instanceof L2FortCommanderInstance) || (target instanceof L2Playable))
if ((target instanceof L2DefenderInstance) || (target instanceof L2NpcInstance) || (target instanceof L2DoorInstance) || target.isAlikeDead() || (target instanceof L2FortCommanderInstance) || target.isPlayable())
{
L2PcInstance player = null;
if ((target != null) && target.isPlayer())
if (target.isPlayer())
{
player = (L2PcInstance) target;
}
@ -140,7 +145,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
return false;
}
}
if ((target != null) && target.isInvul() && ((target.isPlayer() && target.isGM()) || (target.isSummon() && ((L2Summon) target).getOwner().isGM())))
if (target.isInvul() && ((target.isPlayer() && target.isGM()) || (target.isSummon() && ((L2Summon) target).getOwner().isGM())))
{
return false;
}
@ -154,7 +159,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
target = owner;
}
}
return (!(target instanceof L2Playable) || !((L2Playable) target).isSilentMovingAffected() || _actor.isInsideRadius(target, 250, false, false)) && _actor.isAutoAttackable(target) && GeoEngine.getInstance().canSeeTarget(_actor, target);
return (!target.isPlayable() || !((L2Playable) target).isSilentMovingAffected() || _actor.isInsideRadius(target, 250, false, false)) && _actor.isAutoAttackable(target) && GeoEngine.getInstance().canSeeTarget(_actor, target);
}
/**

View File

@ -40,7 +40,7 @@ public abstract class L2PlayableAI extends L2CharacterAI
@Override
protected void onIntentionAttack(L2Character target)
{
if (target instanceof L2Playable)
if ((target != null) && target.isPlayable())
{
if (target.getActingPlayer().isProtectionBlessingAffected() && ((_actor.getActingPlayer().getLevel() - target.getActingPlayer().getLevel()) >= 10) && (_actor.getActingPlayer().getKarma() > 0) && !(target.isInsideZone(ZoneId.PVP)))
{

View File

@ -146,7 +146,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
}
// Check if the target isn't in silent move mode AND too far (>100)
if ((target instanceof L2Playable) && ((L2Playable) target).isSilentMovingAffected() && !_actor.isInsideRadius(target, 250, false, false))
if (target.isPlayable() && ((L2Playable) target).isSilentMovingAffected() && !_actor.isInsideRadius(target, 250, false, false))
{
return false;
}

View File

@ -27,7 +27,6 @@ import com.l2jmobius.gameserver.instancemanager.FortManager;
import com.l2jmobius.gameserver.instancemanager.TerritoryWarManager;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jmobius.gameserver.model.entity.Castle;
import com.l2jmobius.gameserver.model.entity.Fort;
@ -72,7 +71,7 @@ public class L2DefenderInstance extends L2Attackable
public boolean isAutoAttackable(L2Character attacker)
{
// Attackable during siege by all except defenders
if (!(attacker instanceof L2Playable))
if (!attacker.isPlayable())
{
return false;
}
@ -189,7 +188,7 @@ public class L2DefenderInstance extends L2Attackable
if (!(attacker instanceof L2DefenderInstance))
{
if ((damage == 0) && (aggro <= 1) && (attacker instanceof L2Playable))
if ((damage == 0) && (aggro <= 1) && attacker.isPlayable())
{
final L2PcInstance player = attacker.getActingPlayer();
// Check if siege is in progress

View File

@ -37,7 +37,6 @@ import com.l2jmobius.gameserver.model.L2Clan;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.stat.DoorStat;
import com.l2jmobius.gameserver.model.actor.status.DoorStatus;
import com.l2jmobius.gameserver.model.actor.templates.L2DoorTemplate;
@ -330,7 +329,7 @@ public class L2DoorInstance extends L2Character
public boolean isAutoAttackable(L2Character attacker)
{
// Doors can`t be attacked by NPCs
if (!(attacker instanceof L2Playable))
if (!attacker.isPlayable())
{
return false;
}

View File

@ -8650,7 +8650,7 @@ public final class L2PcInstance extends L2Playable
if (_isInDuel)
{
// Get L2PcInstance
if (target instanceof L2Playable)
if (target.isPlayable())
{
// Get L2PcInstance
final L2PcInstance cha = target.getActingPlayer();
@ -13785,11 +13785,15 @@ public final class L2PcInstance extends L2Playable
public boolean canAttackCharacter(L2Character cha)
{
if (cha == null)
{
return false;
}
if (cha instanceof L2Attackable)
{
return true;
}
if (cha instanceof L2Playable)
if (cha.isPlayable())
{
if (cha.isInsideZone(ZoneId.PVP) && !cha.isInsideZone(ZoneId.SIEGE))
{

View File

@ -17,7 +17,6 @@
package com.l2jmobius.gameserver.model.actor.status;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.entity.Duel;
@ -68,7 +67,7 @@ public class SummonStatus extends PlayableStatus
membersInRange++;
}
}
if ((attacker instanceof L2Playable) && (caster.getCurrentCp() > 0))
if (attacker.isPlayable() && (caster.getCurrentCp() > 0))
{
if (caster.getCurrentCp() > transferDmg)
{
@ -94,7 +93,7 @@ public class SummonStatus extends PlayableStatus
if (transferDmg > 0)
{
if ((attacker instanceof L2Playable) && (caster.getCurrentCp() > 0))
if (attacker.isPlayable() && (caster.getCurrentCp() > 0))
{
if (caster.getCurrentCp() > transferDmg)
{

View File

@ -17,7 +17,6 @@
package com.l2jmobius.gameserver.model.conditions;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.skills.Skill;
@ -29,6 +28,6 @@ public class ConditionTargetPlayable extends Condition
@Override
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
{
return effected instanceof L2Playable;
return (effected != null) && effected.isPlayable();
}
}

View File

@ -45,7 +45,6 @@ import com.l2jmobius.gameserver.model.PcCondOverride;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.instance.L2BlockInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2CubicInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@ -1249,12 +1248,12 @@ public final class Skill implements IIdentifiable
public List<AbstractFunction> getStatFuncs(AbstractEffect effect, L2Character player)
{
if (_funcTemplates == null)
if ((_funcTemplates == null) || (player == null))
{
return Collections.<AbstractFunction> emptyList();
}
if (!(player instanceof L2Playable) && !(player instanceof L2Attackable))
if (!player.isPlayable() && !(player instanceof L2Attackable))
{
return Collections.<AbstractFunction> emptyList();
}

View File

@ -51,7 +51,7 @@ public class AdminLevel implements IAdminCommandHandler
{
try
{
if (targetChar instanceof L2Playable)
if ((targetChar != null) && targetChar.isPlayable())
{
((L2Playable) targetChar).getStat().addLevel(Byte.parseByte(val));
}

View File

@ -26,7 +26,6 @@ import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.instance.L2BoatInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.serverpackets.AdminForgePacket;
@ -475,7 +474,7 @@ public final class AdminPForge implements IAdminCommandHandler
case "$tboid":
{
target = activeChar.getTarget();
if ((target != null) && (target instanceof L2Playable))
if ((target != null) && target.isPlayable())
{
boat = target.getActingPlayer().getBoat();
if (boat != null)

View File

@ -41,7 +41,7 @@ public abstract class L2PlayableAI extends L2CharacterAI
@Override
protected void onIntentionAttack(L2Character target)
{
if (target instanceof L2Playable)
if ((target != null) && target.isPlayable())
{
if (target.getActingPlayer().isProtectionBlessingAffected() && ((_actor.getActingPlayer().getLevel() - target.getActingPlayer().getLevel()) >= 10) && (_actor.getActingPlayer().getReputation() < 0) && !(target.isInsideZone(ZoneId.PVP)))
{

View File

@ -24,7 +24,6 @@ import com.l2jmobius.gameserver.instancemanager.FortManager;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jmobius.gameserver.model.entity.Castle;
import com.l2jmobius.gameserver.model.entity.Fort;
@ -60,7 +59,7 @@ public class L2DefenderInstance extends L2Attackable
public boolean isAutoAttackable(L2Character attacker)
{
// Attackable during siege by all except defenders
if (!(attacker instanceof L2Playable))
if (!attacker.isPlayable())
{
return false;
}

View File

@ -17,7 +17,6 @@
package com.l2jmobius.gameserver.model.conditions;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.skills.Skill;
@ -29,6 +28,6 @@ public class ConditionTargetPlayable extends Condition
@Override
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
{
return effected instanceof L2Playable;
return (effected != null) && effected.isPlayable();
}
}

View File

@ -51,7 +51,7 @@ public class AdminLevel implements IAdminCommandHandler
{
try
{
if (targetChar instanceof L2Playable)
if ((targetChar != null) && targetChar.isPlayable())
{
((L2Playable) targetChar).getStat().addLevel(Byte.parseByte(val));
}

View File

@ -26,7 +26,6 @@ import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.instance.L2BoatInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.serverpackets.AdminForgePacket;
@ -475,7 +474,7 @@ public final class AdminPForge implements IAdminCommandHandler
case "$tboid":
{
target = activeChar.getTarget();
if ((target != null) && (target instanceof L2Playable))
if ((target != null) && target.isPlayable())
{
boat = target.getActingPlayer().getBoat();
if (boat != null)

View File

@ -41,7 +41,7 @@ public abstract class L2PlayableAI extends L2CharacterAI
@Override
protected void onIntentionAttack(L2Character target)
{
if (target instanceof L2Playable)
if ((target != null) && target.isPlayable())
{
if (target.getActingPlayer().isProtectionBlessingAffected() && ((_actor.getActingPlayer().getLevel() - target.getActingPlayer().getLevel()) >= 10) && (_actor.getActingPlayer().getReputation() < 0) && !(target.isInsideZone(ZoneId.PVP)))
{

View File

@ -24,7 +24,6 @@ import com.l2jmobius.gameserver.instancemanager.FortManager;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jmobius.gameserver.model.entity.Castle;
import com.l2jmobius.gameserver.model.entity.Fort;
@ -60,7 +59,7 @@ public class L2DefenderInstance extends L2Attackable
public boolean isAutoAttackable(L2Character attacker)
{
// Attackable during siege by all except defenders
if (!(attacker instanceof L2Playable))
if (!attacker.isPlayable())
{
return false;
}

View File

@ -17,7 +17,6 @@
package com.l2jmobius.gameserver.model.conditions;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.skills.Skill;
@ -29,6 +28,6 @@ public class ConditionTargetPlayable extends Condition
@Override
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
{
return effected instanceof L2Playable;
return (effected != null) && effected.isPlayable();
}
}

View File

@ -51,7 +51,7 @@ public class AdminLevel implements IAdminCommandHandler
{
try
{
if (targetChar instanceof L2Playable)
if ((targetChar != null) && targetChar.isPlayable())
{
((L2Playable) targetChar).getStat().addLevel(Byte.parseByte(val));
}

View File

@ -26,7 +26,6 @@ import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.instance.L2BoatInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.serverpackets.AdminForgePacket;
@ -475,7 +474,7 @@ public final class AdminPForge implements IAdminCommandHandler
case "$tboid":
{
target = activeChar.getTarget();
if ((target != null) && (target instanceof L2Playable))
if ((target != null) && target.isPlayable())
{
boat = target.getActingPlayer().getBoat();
if (boat != null)

View File

@ -41,7 +41,7 @@ public abstract class L2PlayableAI extends L2CharacterAI
@Override
protected void onIntentionAttack(L2Character target)
{
if (target instanceof L2Playable)
if ((target != null) && target.isPlayable())
{
if (target.getActingPlayer().isProtectionBlessingAffected() && ((_actor.getActingPlayer().getLevel() - target.getActingPlayer().getLevel()) >= 10) && (_actor.getActingPlayer().getReputation() < 0) && !(target.isInsideZone(ZoneId.PVP)))
{

View File

@ -24,7 +24,6 @@ import com.l2jmobius.gameserver.instancemanager.FortManager;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jmobius.gameserver.model.entity.Castle;
import com.l2jmobius.gameserver.model.entity.Fort;
@ -60,7 +59,7 @@ public class L2DefenderInstance extends L2Attackable
public boolean isAutoAttackable(L2Character attacker)
{
// Attackable during siege by all except defenders
if (!(attacker instanceof L2Playable))
if (!attacker.isPlayable())
{
return false;
}

View File

@ -17,7 +17,6 @@
package com.l2jmobius.gameserver.model.conditions;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.skills.Skill;
@ -29,6 +28,6 @@ public class ConditionTargetPlayable extends Condition
@Override
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
{
return effected instanceof L2Playable;
return (effected != null) && effected.isPlayable();
}
}