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();
}
}