Replaced instanceof L2PcInstance with isPlayer method.

This commit is contained in:
MobiusDev
2018-07-01 00:13:23 +00:00
parent 0259b6527c
commit 5934fac571
365 changed files with 828 additions and 835 deletions

View File

@@ -459,7 +459,7 @@ public class EnergySeeds extends AbstractNpcAI
return super.onEnterZone(character, zone);
}
if (character instanceof L2PcInstance)
if (character.isPlayer())
{
switch (zone.getId())
{

View File

@@ -1456,7 +1456,7 @@ public class SeedOfDestruction extends AbstractNpcAI
@Override
public String onEnterZone(L2Character character, L2ZoneType zone)
{
if (character instanceof L2PcInstance)
if (character.isPlayer())
{
final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(character);
if (tmpworld instanceof SODWorld)

View File

@@ -86,7 +86,7 @@ public final class Anais extends AbstractNpcAI
if ((_current != null) || (_pot < 4))
{
final L2Object target = npc.getTarget();
_nextTarget = target instanceof L2PcInstance ? (L2PcInstance) target : null;
_nextTarget = (target != null) && target.isPlayer() ? (L2PcInstance) target : null;
final L2Npc b = _divineBurners.get(_pot);
_pot = _pot + 1;
b.setDisplayEffect(1);

View File

@@ -195,7 +195,7 @@ public final class AdminCHSiege implements IAdminCommandHandler
{
BuilderUtil.sendSysMessage(activeChar, "You must target a clan member of the attacker!");
}
else if (!(rawTarget instanceof L2PcInstance))
else if (!rawTarget.isPlayer())
{
BuilderUtil.sendSysMessage(activeChar, "You must target a player with clan!");
}
@@ -250,7 +250,7 @@ public final class AdminCHSiege implements IAdminCommandHandler
{
BuilderUtil.sendSysMessage(activeChar, "You must target a clan member of the attacker!");
}
else if (!(rawTarget instanceof L2PcInstance))
else if (!rawTarget.isPlayer())
{
BuilderUtil.sendSysMessage(activeChar, "You must target a player with clan!");
}

View File

@@ -24,6 +24,7 @@ import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.data.xml.impl.AdminData;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2AccessLevel;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.Disconnection;
@@ -49,13 +50,14 @@ public final class AdminChangeAccessLevel implements IAdminCommandHandler
try
{
final int lvl = Integer.parseInt(parts[1]);
if (activeChar.getTarget() instanceof L2PcInstance)
final L2Object target = activeChar.getTarget();
if ((target == null) || !target.isPlayer())
{
onlineChange(activeChar, (L2PcInstance) activeChar.getTarget(), lvl);
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
}
else
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
onlineChange(activeChar, (L2PcInstance) target, lvl);
}
}
catch (Exception e)

View File

@@ -201,15 +201,12 @@ public class AdminClan implements IAdminCommandHandler
else
{
final L2Object targetObj = activeChar.getTarget();
if (targetObj instanceof L2PcInstance)
{
player = targetObj.getActingPlayer();
}
else
if ((targetObj == null) || !targetObj.isPlayer())
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
return null;
}
player = targetObj.getActingPlayer();
}
return player;
}

View File

@@ -20,6 +20,7 @@ import java.util.StringTokenizer;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.items.L2Item;
@@ -116,12 +117,8 @@ public class AdminCreateItem implements IAdminCommandHandler
{
try
{
L2PcInstance target;
if (activeChar.getTarget() instanceof L2PcInstance)
{
target = (L2PcInstance) activeChar.getTarget();
}
else
final L2Object target = activeChar.getTarget();
if ((target == null) || !target.isPlayer())
{
BuilderUtil.sendSysMessage(activeChar, "Invalid target.");
return false;
@@ -135,13 +132,13 @@ public class AdminCreateItem implements IAdminCommandHandler
final int idval = Integer.parseInt(id);
final String num = st.nextToken();
final long numval = Long.parseLong(num);
createItem(activeChar, target, idval, numval);
createItem(activeChar, (L2PcInstance) target, idval, numval);
}
else if (st.countTokens() == 1)
{
final String id = st.nextToken();
final int idval = Integer.parseInt(id);
createItem(activeChar, target, idval, 1);
createItem(activeChar, (L2PcInstance) target, idval, 1);
}
}
catch (StringIndexOutOfBoundsException e)

View File

@@ -205,7 +205,7 @@ public class AdminCursedWeapons implements IAdminCommandHandler
else
{
final L2Object target = activeChar.getTarget();
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
((L2PcInstance) target).addItem("AdminCursedWeaponAdd", id, 1, target, true);
}

View File

@@ -53,7 +53,7 @@ public class AdminDisconnect implements IAdminCommandHandler
{
final L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
player = (L2PcInstance) target;
}

View File

@@ -119,7 +119,7 @@ public class AdminEditChar implements IAdminCommandHandler
{
showCharacterInfo(activeChar, L2World.getInstance().getPlayer(data[1]));
}
else if (activeChar.getTarget() instanceof L2PcInstance)
else if ((activeChar.getTarget() != null) && activeChar.getTarget().isPlayer())
{
showCharacterInfo(activeChar, activeChar.getTarget().getActingPlayer());
}
@@ -192,7 +192,7 @@ public class AdminEditChar implements IAdminCommandHandler
{
editCharacter(activeChar, data[1]);
}
else if (activeChar.getTarget() instanceof L2PcInstance)
else if ((activeChar.getTarget() != null) && activeChar.getTarget().isPlayer())
{
editCharacter(activeChar, null);
}
@@ -230,7 +230,7 @@ public class AdminEditChar implements IAdminCommandHandler
final String val = command.substring(12);
final int pk = Integer.parseInt(val);
final L2Object target = activeChar.getTarget();
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
final L2PcInstance player = (L2PcInstance) target;
player.setPkKills(pk);
@@ -261,7 +261,7 @@ public class AdminEditChar implements IAdminCommandHandler
final String val = command.substring(13);
final int pvp = Integer.parseInt(val);
final L2Object target = activeChar.getTarget();
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
final L2PcInstance player = (L2PcInstance) target;
player.setPvpKills(pvp);
@@ -292,7 +292,7 @@ public class AdminEditChar implements IAdminCommandHandler
final String val = command.substring(14);
final int fame = Integer.parseInt(val);
final L2Object target = activeChar.getTarget();
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
final L2PcInstance player = (L2PcInstance) target;
player.setFame(fame);
@@ -323,7 +323,7 @@ public class AdminEditChar implements IAdminCommandHandler
final String val = command.substring(10);
final int recVal = Integer.parseInt(val);
final L2Object target = activeChar.getTarget();
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
final L2PcInstance player = (L2PcInstance) target;
player.setRecomHave(recVal);
@@ -355,7 +355,7 @@ public class AdminEditChar implements IAdminCommandHandler
final int classidval = Integer.parseInt(val);
final L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
player = (L2PcInstance) target;
}
@@ -452,7 +452,7 @@ public class AdminEditChar implements IAdminCommandHandler
final String val = command.substring(15);
final L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
player = (L2PcInstance) target;
}
@@ -476,7 +476,7 @@ public class AdminEditChar implements IAdminCommandHandler
final String val = command.substring(17);
final L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
player = (L2PcInstance) target;
}
@@ -523,7 +523,7 @@ public class AdminEditChar implements IAdminCommandHandler
{
final L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
player = (L2PcInstance) target;
}
@@ -546,7 +546,7 @@ public class AdminEditChar implements IAdminCommandHandler
final String val = command.substring(15);
final L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
player = (L2PcInstance) target;
}
@@ -570,7 +570,7 @@ public class AdminEditChar implements IAdminCommandHandler
final String val = command.substring(16);
final L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
player = (L2PcInstance) target;
}
@@ -695,7 +695,7 @@ public class AdminEditChar implements IAdminCommandHandler
else
{
final L2Object target = activeChar.getTarget();
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
pl = (L2PcInstance) target;
}
@@ -832,7 +832,7 @@ public class AdminEditChar implements IAdminCommandHandler
target = activeChar.getTarget();
}
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
if (((L2PcInstance) target).isInParty())
{
@@ -856,7 +856,7 @@ public class AdminEditChar implements IAdminCommandHandler
{
player = activeChar;
}
else if ((activeChar.getTarget() != null) && (activeChar.getTarget() instanceof L2PcInstance))
else if ((activeChar.getTarget() != null) && (activeChar.getTarget().isPlayer()))
{
player = (L2PcInstance) activeChar.getTarget();
}
@@ -991,7 +991,7 @@ public class AdminEditChar implements IAdminCommandHandler
if (player == null)
{
final L2Object target = activeChar.getTarget();
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
player = (L2PcInstance) target;
}
@@ -1095,7 +1095,7 @@ public class AdminEditChar implements IAdminCommandHandler
// function to change karma of selected char
final L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
player = (L2PcInstance) target;
}
@@ -1136,7 +1136,7 @@ public class AdminEditChar implements IAdminCommandHandler
target = activeChar.getTarget();
}
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
final L2PcInstance player = (L2PcInstance) target;
gatherCharacterInfo(activeChar, player, "charedit.htm");

View File

@@ -633,7 +633,7 @@ public class AdminEffects implements IAdminCommandHandler
activeChar.sendPacket(SystemMessageId.NOTHING_HAPPENED);
return false;
}
if ((target instanceof L2PcInstance) && ((action < 2) || ((action > 18) && (action != SocialAction.LEVEL_UP))))
if (target.isPlayer() && ((action < 2) || ((action > 18) && (action != SocialAction.LEVEL_UP))))
{
activeChar.sendPacket(SystemMessageId.NOTHING_HAPPENED);
return false;

View File

@@ -118,7 +118,7 @@ public class AdminElement implements IAdminCommandHandler
target = activeChar;
}
L2PcInstance player = null;
if (target instanceof L2PcInstance)
if (target.isPlayer())
{
player = (L2PcInstance) target;
}

View File

@@ -178,7 +178,7 @@ public class AdminEnchant implements IAdminCommandHandler
target = activeChar;
}
L2PcInstance player = null;
if (target instanceof L2PcInstance)
if (target.isPlayer())
{
player = (L2PcInstance) target;
}

View File

@@ -385,7 +385,7 @@ public class AdminEventEngine implements IAdminCommandHandler
}
else
{
if ((activeChar.getTarget() != null) && (activeChar.getTarget() instanceof L2PcInstance))
if ((activeChar.getTarget() != null) && (activeChar.getTarget().isPlayer()))
{
L2Event.removeAndResetPlayer((L2PcInstance) activeChar.getTarget());
}

View File

@@ -90,7 +90,7 @@ public class AdminExpSp implements IAdminCommandHandler
{
final L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
player = (L2PcInstance) target;
}
@@ -113,7 +113,7 @@ public class AdminExpSp implements IAdminCommandHandler
{
final L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
player = (L2PcInstance) target;
}
@@ -156,7 +156,7 @@ public class AdminExpSp implements IAdminCommandHandler
{
final L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
player = (L2PcInstance) target;
}

View File

@@ -74,7 +74,7 @@ public class AdminFortSiege implements IAdminCommandHandler
{
final L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
player = (L2PcInstance) target;
}

View File

@@ -78,7 +78,7 @@ public class AdminGmChat implements IAdminCommandHandler
activeChar.sendPacket(SystemMessageId.SELECT_TARGET);
return;
}
if (!(target instanceof L2PcInstance))
if (!target.isPlayer())
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
return;

View File

@@ -96,7 +96,7 @@ public class AdminHeal implements IAdminCommandHandler
L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, character ->
{
character.setCurrentHpMp(character.getMaxHp(), character.getMaxMp());
if (character instanceof L2PcInstance)
if (character.isPlayer())
{
character.setCurrentCp(character.getMaxCp());
}
@@ -118,7 +118,7 @@ public class AdminHeal implements IAdminCommandHandler
{
final L2Character target = (L2Character) obj;
target.setCurrentHpMp(target.getMaxHp(), target.getMaxMp());
if (target instanceof L2PcInstance)
if (target.isPlayer())
{
target.setCurrentCp(target.getMaxCp());
}

View File

@@ -114,7 +114,7 @@ public class AdminInstance implements IAdminCommandHandler
return false;
}
target.setInstanceId(val);
if (target instanceof L2PcInstance)
if (target.isPlayer())
{
final L2PcInstance player = (L2PcInstance) target;
player.sendMessage("Admin set your instance to:" + val);

View File

@@ -95,7 +95,7 @@ public class AdminInstanceZone implements IAdminCommandHandler
}
else if (activeChar.getTarget() != null)
{
if (activeChar.getTarget() instanceof L2PcInstance)
if (activeChar.getTarget().isPlayer())
{
display((L2PcInstance) activeChar.getTarget(), activeChar);
}

View File

@@ -45,7 +45,7 @@ public class AdminInvul implements IAdminCommandHandler
if (command.equals("admin_setinvul"))
{
final L2Object target = activeChar.getTarget();
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
handleInvul((L2PcInstance) target);
}

View File

@@ -124,7 +124,7 @@ public class AdminKill implements IAdminCommandHandler
private void kill(L2PcInstance activeChar, L2Character target)
{
if (target instanceof L2PcInstance)
if (target.isPlayer())
{
if (!((L2PcInstance) target).isGM())
{

View File

@@ -65,7 +65,7 @@ public class AdminLevel implements IAdminCommandHandler
{
try
{
if (!(targetChar instanceof L2PcInstance))
if ((targetChar == null) || !targetChar.isPlayer())
{
activeChar.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); // incorrect target!
return false;

View File

@@ -233,7 +233,7 @@ public class AdminMenu implements IAdminCommandHandler
}
if (target != null)
{
if (target instanceof L2PcInstance)
if (target.isPlayer())
{
target.reduceCurrentHp(target.getMaxHp() + target.getMaxCp() + 1, activeChar, null);
filename = "charmanage.htm";
@@ -267,7 +267,7 @@ public class AdminMenu implements IAdminCommandHandler
private void teleportToCharacter(L2PcInstance activeChar, L2Object target)
{
L2PcInstance player = null;
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
player = (L2PcInstance) target;
}

View File

@@ -102,7 +102,7 @@ public class AdminPetition implements IAdminCommandHandler
try
{
final L2Object targetChar = activeChar.getTarget();
if ((targetChar == null) || !(targetChar instanceof L2PcInstance))
if ((targetChar == null) || !targetChar.isPlayer())
{
activeChar.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
return false;

View File

@@ -51,7 +51,7 @@ public class AdminPledge implements IAdminCommandHandler
{
final L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
player = (L2PcInstance) target;
}

View File

@@ -141,7 +141,7 @@ public class AdminRes implements IAdminCommandHandler
L2World.getInstance().forEachVisibleObjectInRange(activeChar, L2Character.class, radius, knownChar ->
{
if (!(knownChar instanceof L2PcInstance) && !(knownChar instanceof L2ControllableMobInstance))
if (!knownChar.isPlayer() && !(knownChar instanceof L2ControllableMobInstance))
{
doResurrect(knownChar);
}
@@ -156,9 +156,9 @@ public class AdminRes implements IAdminCommandHandler
return;
}
if ((obj instanceof L2PcInstance) || (obj instanceof L2ControllableMobInstance))
if ((obj == null) || (obj.isPlayer()) || (obj instanceof L2ControllableMobInstance))
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
activeChar.sendPacket(SystemMessageId.INCORRECT_ITEM);
return;
}
@@ -173,7 +173,7 @@ public class AdminRes implements IAdminCommandHandler
}
// If the target is a player, then restore the XP lost on death.
if (targetChar instanceof L2PcInstance)
if (targetChar.isPlayer())
{
((L2PcInstance) targetChar).restoreExp(100.0);
}

View File

@@ -132,7 +132,7 @@ public class AdminRide implements IAdminCommandHandler
{
L2PcInstance player = null;
if ((activeChar.getTarget() == null) || (activeChar.getTarget().getObjectId() == activeChar.getObjectId()) || !(activeChar.getTarget() instanceof L2PcInstance))
if ((activeChar.getTarget() == null) || (activeChar.getTarget().getObjectId() == activeChar.getObjectId()) || !activeChar.getTarget().isPlayer())
{
player = activeChar;
}

View File

@@ -272,7 +272,7 @@ public class AdminTeleport implements IAdminCommandHandler
else
{
final L2Object target = activeChar.getTarget();
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
teleportHome(target.getActingPlayer());
}
@@ -369,7 +369,7 @@ public class AdminTeleport implements IAdminCommandHandler
{
final L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
player = (L2PcInstance) target;
}
@@ -389,7 +389,7 @@ public class AdminTeleport implements IAdminCommandHandler
{
final L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (target instanceof L2PcInstance)
if ((target != null) && target.isPlayer())
{
player = (L2PcInstance) target;
}
@@ -464,7 +464,7 @@ public class AdminTeleport implements IAdminCommandHandler
}
L2PcInstance player = null;
if (target instanceof L2PcInstance)
if (target.isPlayer())
{
player = (L2PcInstance) target;
}

View File

@@ -44,7 +44,7 @@ public class AdminTvTEvent implements IAdminCommandHandler
{
final L2Object target = activeChar.getTarget();
if (!(target instanceof L2PcInstance))
if ((target == null) || !target.isPlayer())
{
BuilderUtil.sendSysMessage(activeChar, "You should select a player!");
return true;
@@ -56,7 +56,7 @@ public class AdminTvTEvent implements IAdminCommandHandler
{
final L2Object target = activeChar.getTarget();
if (!(target instanceof L2PcInstance))
if ((target == null) || !target.isPlayer())
{
BuilderUtil.sendSysMessage(activeChar, "You should select a player!");
return true;

View File

@@ -59,7 +59,7 @@ public class AdminVitality implements IAdminCommandHandler
final StringTokenizer st = new StringTokenizer(command, " ");
final String cmd = st.nextToken();
if (activeChar.getTarget() instanceof L2PcInstance)
if ((activeChar.getTarget() != null) && activeChar.getTarget().isPlayer())
{
L2PcInstance target;
target = (L2PcInstance) activeChar.getTarget();

View File

@@ -73,7 +73,7 @@ public final class EnergyAttack extends AbstractEffect
@Override
public void onStart(BuffInfo info)
{
final L2PcInstance attacker = info.getEffector() instanceof L2PcInstance ? (L2PcInstance) info.getEffector() : null;
final L2PcInstance attacker = info.getEffector().isPlayer() ? (L2PcInstance) info.getEffector() : null;
if (attacker == null)
{
return;
@@ -137,14 +137,14 @@ public final class EnergyAttack extends AbstractEffect
attack *= energyChargesBoost;
attack *= weaponTypeBoost;
if (target instanceof L2PcInstance)
if (target.isPlayer())
{
defence *= target.getStat().calcStat(Stats.PVP_PHYS_SKILL_DEF, 1.0);
}
damage = attack / defence;
damage *= damageMultiplier;
if (target instanceof L2PcInstance)
if (target.isPlayer())
{
damage *= attacker.getStat().calcStat(Stats.PVP_PHYS_SKILL_DMG, 1.0);
damage = attacker.getStat().calcStat(Stats.PHYSICAL_SKILL_POWER, damage);

View File

@@ -55,7 +55,7 @@ public final class GiveRecommendation extends AbstractEffect
@Override
public void onStart(BuffInfo info)
{
final L2PcInstance target = info.getEffected() instanceof L2PcInstance ? (L2PcInstance) info.getEffected() : null;
final L2PcInstance target = (info.getEffected() != null) && info.getEffected().isPlayer() ? (L2PcInstance) info.getEffected() : null;
if (target != null)
{
int recommendationsGiven = _amount;
@@ -80,7 +80,7 @@ public final class GiveRecommendation extends AbstractEffect
}
else
{
final L2PcInstance player = info.getEffector() instanceof L2PcInstance ? (L2PcInstance) info.getEffector() : null;
final L2PcInstance player = (info.getEffector() != null) && info.getEffector().isPlayer() ? (L2PcInstance) info.getEffector() : null;
if (player != null)
{
player.sendPacket(SystemMessageId.NOTHING_HAPPENED);

View File

@@ -31,7 +31,7 @@ public class Bypass implements IItemHandler
@Override
public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse)
{
if (!(playable instanceof L2PcInstance))
if (!playable.isPlayer())
{
return false;
}

View File

@@ -138,7 +138,7 @@ public class Wedding implements IVoicedCommandHandler
activeChar.sendMessage("You have no one targeted.");
return false;
}
else if (!(activeChar.getTarget() instanceof L2PcInstance))
else if (!activeChar.getTarget().isPlayer())
{
activeChar.sendMessage("You can only ask another player to engage you.");
return false;

View File

@@ -2012,7 +2012,7 @@ public final class CrystalCaverns extends AbstractInstance
@Override
public String onEnterZone(L2Character character, L2ZoneType zone)
{
if (character instanceof L2PcInstance)
if (character.isPlayer())
{
final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(character);
if (tmpworld instanceof CCWorld)
@@ -2079,7 +2079,7 @@ public final class CrystalCaverns extends AbstractInstance
@Override
public String onExitZone(L2Character character, L2ZoneType zone)
{
if (character instanceof L2PcInstance)
if (character.isPlayer())
{
final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(character);
if (tmpworld instanceof CCWorld)

View File

@@ -461,7 +461,7 @@ public final class NornilsGarden extends AbstractInstance
@Override
public String onEnterZone(L2Character character, L2ZoneType zone)
{
if ((character instanceof L2PcInstance) && !character.isDead() && !character.isTeleporting() && ((L2PcInstance) character).isOnline())
if (character.isPlayer() && !character.isDead() && !character.isTeleporting() && ((L2PcInstance) character).isOnline())
{
final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(character);
if (tmpworld instanceof NornilsWorld)

View File

@@ -868,7 +868,7 @@ public class Q00144_PailakaInjuredDragon extends Quest
@Override
public String onEnterZone(L2Character character, L2ZoneType zone)
{
if ((character instanceof L2PcInstance) && !character.isDead() && !character.isTeleporting() && ((L2PcInstance) character).isOnline())
if (character.isPlayer() && !character.isDead() && !character.isTeleporting() && ((L2PcInstance) character).isOnline())
{
final InstanceWorld world = InstanceManager.getInstance().getWorld(character);
if ((world != null) && (world.getTemplateId() == INSTANCE_ID))

View File

@@ -207,7 +207,7 @@ public class TerritoryWarSuperClass extends Quest
@Override
public String onDeath(L2Character killer, L2Character victim, QuestState qs)
{
if ((killer == victim) || !(victim instanceof L2PcInstance) || (victim.getLevel() < 61))
if ((killer == victim) || !victim.isPlayer() || (victim.getLevel() < 61))
{
return "";
}