Replaced instanceof L2PcInstance with isPlayer method.
This commit is contained in:
@@ -423,7 +423,7 @@ public abstract class AbstractAI implements Ctrl
|
||||
*/
|
||||
protected void clientActionFailed()
|
||||
{
|
||||
if (_actor instanceof L2PcInstance)
|
||||
if (_actor.isPlayer())
|
||||
{
|
||||
_actor.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
}
|
||||
@@ -641,7 +641,7 @@ public abstract class AbstractAI implements Ctrl
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (_actor instanceof L2PcInstance)
|
||||
if (_actor.isPlayer())
|
||||
{
|
||||
if (!AttackStanceTaskManager.getInstance().hasAttackStanceTask(_actor) && isAutoAttacking())
|
||||
{
|
||||
|
@@ -1045,7 +1045,7 @@ public class L2CharacterAI extends AbstractAI
|
||||
if ((target == null) || target.isAlikeDead())
|
||||
{
|
||||
// check if player is fakedeath
|
||||
if ((target instanceof L2PcInstance) && ((L2PcInstance) target).isFakeDeath())
|
||||
if ((target != null) && target.isPlayer() && ((L2PcInstance) target).isFakeDeath())
|
||||
{
|
||||
target.stopFakeDeath(true);
|
||||
return false;
|
||||
@@ -1076,7 +1076,7 @@ public class L2CharacterAI extends AbstractAI
|
||||
protected boolean checkTargetLost(L2Object target)
|
||||
{
|
||||
// check if player is fakedeath
|
||||
if (target instanceof L2PcInstance)
|
||||
if ((target != null) && target.isPlayer())
|
||||
{
|
||||
final L2PcInstance target2 = (L2PcInstance) target; // convert object to chara
|
||||
|
||||
|
@@ -269,7 +269,7 @@ public class L2PlayerAI extends L2PlayableAI
|
||||
private void thinkCast()
|
||||
{
|
||||
final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false);
|
||||
if ((_skill.getTargetType() == TargetType.GROUND) && (_actor instanceof L2PcInstance))
|
||||
if ((_skill.getTargetType() == TargetType.GROUND) && _actor.isPlayer())
|
||||
{
|
||||
if (maybeMoveToPosition(((L2PcInstance) _actor).getCurrentSkillWorldPosition(), _actor.getMagicalAttackRange(_skill)))
|
||||
{
|
||||
|
@@ -915,7 +915,7 @@ public class L2Attackable extends L2Npc
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ai.getAttacker() instanceof L2PcInstance)
|
||||
if (ai.getAttacker().isPlayer())
|
||||
{
|
||||
final L2PcInstance act = (L2PcInstance) ai.getAttacker();
|
||||
if (act.isInvisible() || act.isInvul() || act.isSpawnProtected())
|
||||
|
@@ -714,7 +714,7 @@ public abstract class L2Summon extends L2Playable
|
||||
}
|
||||
}
|
||||
|
||||
if (_owner.isInOlympiadMode() && (target instanceof L2PcInstance) && ((L2PcInstance) target).isInOlympiadMode() && (((L2PcInstance) target).getOlympiadGameId() == _owner.getOlympiadGameId()))
|
||||
if (_owner.isInOlympiadMode() && target.isPlayer() && ((L2PcInstance) target).isInOlympiadMode() && (((L2PcInstance) target).getOlympiadGameId() == _owner.getOlympiadGameId()))
|
||||
{
|
||||
OlympiadGameManager.getInstance().notifyCompetitorDamage(getOwner(), damage);
|
||||
}
|
||||
|
@@ -103,7 +103,7 @@ public class L2BlockInstance extends L2MonsterInstance
|
||||
@Override
|
||||
public boolean isAutoAttackable(L2Character attacker)
|
||||
{
|
||||
if (attacker instanceof L2PcInstance)
|
||||
if (attacker.isPlayer())
|
||||
{
|
||||
return (attacker.getActingPlayer() != null) && (attacker.getActingPlayer().getBlockCheckerArena() > -1);
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ public class L2FortCommanderInstance extends L2DefenderInstance
|
||||
@Override
|
||||
public boolean isAutoAttackable(L2Character attacker)
|
||||
{
|
||||
if ((attacker == null) || !(attacker instanceof L2PcInstance))
|
||||
if ((attacker == null) || !attacker.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@@ -4260,7 +4260,12 @@ public final class L2PcInstance extends L2Playable
|
||||
*/
|
||||
public void doInteract(L2Character target)
|
||||
{
|
||||
if (target instanceof L2PcInstance)
|
||||
if (target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.isPlayer())
|
||||
{
|
||||
final L2PcInstance targetPlayer = (L2PcInstance) target;
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
@@ -4278,7 +4283,7 @@ public final class L2PcInstance extends L2Playable
|
||||
sendPacket(new RecipeShopSellList(this, targetPlayer));
|
||||
}
|
||||
}
|
||||
else if (target != null) // _interactTarget=null should never happen but one never knows ^^;
|
||||
else // _interactTarget=null should never happen but one never knows ^^;
|
||||
{
|
||||
target.onAction(this);
|
||||
}
|
||||
|
@@ -132,7 +132,7 @@ public final class L2TrapInstance extends L2Npc
|
||||
return true;
|
||||
}
|
||||
|
||||
if (cha instanceof L2PcInstance)
|
||||
if (cha.isPlayer())
|
||||
{
|
||||
// observers can't see trap
|
||||
if (((L2PcInstance) cha).inObserverMode())
|
||||
@@ -260,7 +260,7 @@ public final class L2TrapInstance extends L2Npc
|
||||
return;
|
||||
}
|
||||
|
||||
if (_owner.isInOlympiadMode() && (target instanceof L2PcInstance) && ((L2PcInstance) target).isInOlympiadMode() && (((L2PcInstance) target).getOlympiadGameId() == _owner.getOlympiadGameId()))
|
||||
if (_owner.isInOlympiadMode() && target.isPlayer() && ((L2PcInstance) target).isInOlympiadMode() && (((L2PcInstance) target).getOlympiadGameId() == _owner.getOlympiadGameId()))
|
||||
{
|
||||
OlympiadGameManager.getInstance().notifyCompetitorDamage(getOwner(), damage);
|
||||
}
|
||||
|
@@ -175,7 +175,7 @@ public class PlayableStat extends CharStat
|
||||
setExp(getExpForLevel(getLevel()));
|
||||
}
|
||||
|
||||
if (!levelIncreased && (getActiveChar() instanceof L2PcInstance) && !getActiveChar().isGM() && Config.DECREASE_SKILL_LEVEL)
|
||||
if (!levelIncreased && getActiveChar().isPlayer() && !getActiveChar().isGM() && Config.DECREASE_SKILL_LEVEL)
|
||||
{
|
||||
((L2PcInstance) getActiveChar()).checkPlayerSkills();
|
||||
}
|
||||
|
@@ -81,7 +81,7 @@ public final class ConditionSiegeZone extends Condition
|
||||
*/
|
||||
public static boolean checkIfOk(L2Character activeChar, Castle castle, int value)
|
||||
{
|
||||
if ((activeChar == null) || !(activeChar instanceof L2PcInstance))
|
||||
if ((activeChar == null) || !activeChar.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public final class ConditionSiegeZone extends Condition
|
||||
*/
|
||||
public static boolean checkIfOk(L2Character activeChar, Fort fort, int value)
|
||||
{
|
||||
if ((activeChar == null) || !(activeChar instanceof L2PcInstance))
|
||||
if ((activeChar == null) || !activeChar.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ public class ConditionTargetAggro extends Condition
|
||||
{
|
||||
return ((L2MonsterInstance) effected).isAggressive() == _isAggro;
|
||||
}
|
||||
if (effected instanceof L2PcInstance)
|
||||
if (effected.isPlayer())
|
||||
{
|
||||
return ((L2PcInstance) effected).getReputation() < 0;
|
||||
}
|
||||
|
@@ -394,7 +394,7 @@ public abstract class Inventory extends ItemContainer
|
||||
@Override
|
||||
public void notifyEquiped(int slot, L2ItemInstance item, Inventory inventory)
|
||||
{
|
||||
if (!(inventory.getOwner() instanceof L2PcInstance))
|
||||
if (!inventory.getOwner().isPlayer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -489,7 +489,7 @@ public abstract class Inventory extends ItemContainer
|
||||
@Override
|
||||
public void notifyEquiped(int slot, L2ItemInstance item, Inventory inventory)
|
||||
{
|
||||
if (!(inventory.getOwner() instanceof L2PcInstance))
|
||||
if (!inventory.getOwner().isPlayer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -618,7 +618,7 @@ public abstract class Inventory extends ItemContainer
|
||||
@Override
|
||||
public void notifyUnequiped(int slot, L2ItemInstance item, Inventory inventory)
|
||||
{
|
||||
if (!(inventory.getOwner() instanceof L2PcInstance))
|
||||
if (!inventory.getOwner().isPlayer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1498,13 +1498,13 @@ public abstract class Inventory extends ItemContainer
|
||||
*/
|
||||
public void equipItem(L2ItemInstance item)
|
||||
{
|
||||
if ((getOwner() instanceof L2PcInstance) && (((L2PcInstance) getOwner()).getPrivateStoreType() != PrivateStoreType.NONE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (getOwner().isPlayer())
|
||||
{
|
||||
if (((L2PcInstance) getOwner()).getPrivateStoreType() != PrivateStoreType.NONE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance player = (L2PcInstance) getOwner();
|
||||
|
||||
if (!player.canOverrideCond(PcCondOverride.ITEM_CONDITIONS) && !player.isHero() && item.isHeroItem())
|
||||
|
@@ -22,7 +22,6 @@ import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcSkillSee;
|
||||
import com.l2jmobius.gameserver.model.items.type.WeaponType;
|
||||
@@ -288,7 +287,7 @@ public final class L2Weapon extends L2Item
|
||||
if (type == ItemSkillType.ON_MAGIC_SKILL)
|
||||
{
|
||||
// notify quests of a skill use
|
||||
if (caster instanceof L2PcInstance)
|
||||
if (caster.isPlayer())
|
||||
{
|
||||
L2World.getInstance().forEachVisibleObjectInRange(caster, L2Npc.class, 1000, npc ->
|
||||
{
|
||||
|
@@ -231,7 +231,7 @@ public abstract class L2ZoneType extends ListenersContainer
|
||||
return false;
|
||||
}
|
||||
|
||||
if (character instanceof L2PcInstance)
|
||||
if (character.isPlayer())
|
||||
{
|
||||
// Check class type
|
||||
if (_classType != 0)
|
||||
|
@@ -17,7 +17,6 @@
|
||||
package com.l2jmobius.gameserver.model.zone.type;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.zone.L2ZoneType;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
@@ -36,7 +35,7 @@ public class L2ArenaZone extends L2ZoneType
|
||||
@Override
|
||||
protected void onEnter(L2Character character)
|
||||
{
|
||||
if (character instanceof L2PcInstance)
|
||||
if (character.isPlayer())
|
||||
{
|
||||
if (!character.isInsideZone(ZoneId.PVP))
|
||||
{
|
||||
@@ -50,7 +49,7 @@ public class L2ArenaZone extends L2ZoneType
|
||||
@Override
|
||||
protected void onExit(L2Character character)
|
||||
{
|
||||
if (character instanceof L2PcInstance)
|
||||
if (character.isPlayer())
|
||||
{
|
||||
if (!character.isInsideZone(ZoneId.PVP))
|
||||
{
|
||||
|
@@ -136,7 +136,7 @@ public final class Broadcast
|
||||
*/
|
||||
public static void toSelfAndKnownPlayers(L2Character character, IClientOutgoingPacket mov)
|
||||
{
|
||||
if (character instanceof L2PcInstance)
|
||||
if (character.isPlayer())
|
||||
{
|
||||
character.sendPacket(mov);
|
||||
}
|
||||
@@ -152,7 +152,7 @@ public final class Broadcast
|
||||
radius = 600;
|
||||
}
|
||||
|
||||
if (character instanceof L2PcInstance)
|
||||
if (character.isPlayer())
|
||||
{
|
||||
character.sendPacket(mov);
|
||||
}
|
||||
|
Reference in New Issue
Block a user