Replaced instanceof L2ItemInstance with isItem method.
This commit is contained in:
@@ -507,7 +507,7 @@ public class L2CharacterAI extends AbstractAI
|
||||
return;
|
||||
}
|
||||
|
||||
if ((object instanceof L2ItemInstance) && (((L2ItemInstance) object).getLocation() != ItemLocation.VOID))
|
||||
if (object.isItem() && (((L2ItemInstance) object).getLocation() != ItemLocation.VOID))
|
||||
{
|
||||
// Cancel action client side by sending Server->Client packet ActionFailed to the L2PcInstance actor
|
||||
clientActionFailed();
|
||||
|
@@ -297,7 +297,7 @@ public abstract class L2Object
|
||||
* <BR>
|
||||
* <B><U> Assert </U> :</B><BR>
|
||||
* <BR>
|
||||
* <li>this instanceof L2ItemInstance</li>
|
||||
* <li>this.isItem().</li>
|
||||
* <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li> <BR>
|
||||
* <BR>
|
||||
* <B><U> Example of use </U> :</B><BR>
|
||||
@@ -331,7 +331,7 @@ public abstract class L2Object
|
||||
}
|
||||
|
||||
// if this item is a mercenary ticket, remove the spawns!
|
||||
if (this instanceof L2ItemInstance)
|
||||
if (isItem())
|
||||
{
|
||||
final int itemId = ((L2ItemInstance) this).getItemId();
|
||||
if (MercTicketManager.getInstance().getTicketCastleId(itemId) > 0)
|
||||
|
@@ -339,7 +339,7 @@ public class TradeList
|
||||
|
||||
L2Object o = L2World.getInstance().findObject(objectId);
|
||||
|
||||
if ((o == null) || !(o instanceof L2ItemInstance))
|
||||
if ((o == null) || !o.isItem())
|
||||
{
|
||||
Util.handleIllegalPlayerAction(_owner, "Player " + _owner.getName() + " Attempt to add invalid item to TradeList! ", Config.DEFAULT_PUNISH);
|
||||
LOGGER.warning(_owner.getName() + ": Attempt to add invalid item to TradeList!");
|
||||
@@ -1159,7 +1159,7 @@ public class TradeList
|
||||
}
|
||||
|
||||
final L2Object obj = L2World.getInstance().findObject(item.getObjectId());
|
||||
if ((obj == null) || (!(obj instanceof L2ItemInstance)))
|
||||
if ((obj == null) || !obj.isItem())
|
||||
{
|
||||
final String msgErr = "[RequestPrivateStoreSell] player " + _owner.getName() + " tried to sell null item in a private store (buy), ban this player!";
|
||||
Util.handleIllegalPlayerAction(_owner, msgErr, Config.DEFAULT_PUNISH);
|
||||
|
@@ -6647,7 +6647,7 @@ public final class L2PcInstance extends L2Playable
|
||||
getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
|
||||
// Check if the L2Object to pick up is a L2ItemInstance
|
||||
if (!(object instanceof L2ItemInstance))
|
||||
if (!object.isItem())
|
||||
{
|
||||
// dont try to pickup anything that is not an item :)
|
||||
LOGGER.warning(this + "trying to pickup wrong target." + getTarget());
|
||||
|
@@ -558,7 +558,7 @@ public class L2PetInstance extends L2Summon
|
||||
|
||||
broadcastPacket(sm);
|
||||
|
||||
if (!(object instanceof L2ItemInstance))
|
||||
if (!object.isItem())
|
||||
{
|
||||
// dont try to pickup anything that is not an item :)
|
||||
LOGGER.warning("Trying to pickup wrong target." + object);
|
||||
|
@@ -120,7 +120,7 @@ public class PcKnownList extends PlayableKnownList
|
||||
}
|
||||
else
|
||||
{
|
||||
if (object instanceof L2ItemInstance)
|
||||
if (object.isItem())
|
||||
{
|
||||
if (dropper != null)
|
||||
{
|
||||
|
@@ -84,7 +84,7 @@ public class RequestRecordInfo extends L2GameClientPacket
|
||||
}
|
||||
else
|
||||
{
|
||||
if (object instanceof L2ItemInstance)
|
||||
if (object.isItem())
|
||||
{
|
||||
_activeChar.sendPacket(new SpawnItem((L2ItemInstance) object));
|
||||
}
|
||||
|
@@ -19,7 +19,6 @@ package com.l2jmobius.gameserver.network.serverpackets;
|
||||
import com.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.templates.chars.L2NpcTemplate;
|
||||
|
||||
/**
|
||||
@@ -99,7 +98,7 @@ public class NpcInfoPoly extends L2GameServerPacket
|
||||
_lhand = _template.lhand;
|
||||
}
|
||||
|
||||
if (_obj instanceof L2ItemInstance)
|
||||
if (_obj.isItem())
|
||||
{
|
||||
_x = _obj.getX();
|
||||
_y = _obj.getY();
|
||||
|
@@ -32,7 +32,7 @@ public class SpawnItemPoly extends L2GameServerPacket
|
||||
|
||||
public SpawnItemPoly(L2Object object)
|
||||
{
|
||||
if (object instanceof L2ItemInstance)
|
||||
if (object.isItem())
|
||||
{
|
||||
final L2ItemInstance item = (L2ItemInstance) object;
|
||||
_objectId = object.getObjectId();
|
||||
|
@@ -53,7 +53,7 @@ public class ItemFilter implements Filter
|
||||
}
|
||||
if (_excludeItemType != null)
|
||||
{
|
||||
// if (record.getParameters() == null || record.getParameters().length == 0 || !(record.getParameters()[0] instanceof L2ItemInstance))
|
||||
// if (record.getParameters() == null || record.getParameters().length == 0 || !(record.getParameters()[0].isItem().))
|
||||
// return true;
|
||||
final L2ItemInstance item = (L2ItemInstance) record.getParameters()[0];
|
||||
|
||||
|
@@ -1104,7 +1104,7 @@ public class GameStatusThread extends Thread
|
||||
AICount++;
|
||||
}
|
||||
}
|
||||
if (obj instanceof L2ItemInstance)
|
||||
if (obj.isItem())
|
||||
{
|
||||
if (((L2ItemInstance) obj).getLocation() == L2ItemInstance.ItemLocation.VOID)
|
||||
{
|
||||
|
Reference in New Issue
Block a user