Replaced instanceof L2ItemInstance with isItem method.

This commit is contained in:
MobiusDev
2018-06-30 15:41:20 +00:00
parent 94d1362588
commit d806ff66e5
66 changed files with 75 additions and 76 deletions

View File

@@ -413,7 +413,7 @@ public class L2CharacterAI extends AbstractAI
// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
clientStopAutoAttack();
if ((object instanceof L2ItemInstance) && (((L2ItemInstance) object).getItemLocation() != ItemLocation.VOID))
if (object.isItem() && (((L2ItemInstance) object).getItemLocation() != ItemLocation.VOID))
{
return;
}

View File

@@ -184,7 +184,7 @@ public class TradeList
}
final L2Object o = L2World.getInstance().findObject(objectId);
if (!(o instanceof L2ItemInstance))
if (!o.isItem())
{
LOGGER.warning(_owner.getName() + ": Trying to add something other than an item!");
return null;

View File

@@ -462,7 +462,7 @@ public class L2PetInstance extends L2Summon
getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
broadcastPacket(new StopMove(this));
if (!(object instanceof L2ItemInstance))
if (!object.isItem())
{
// dont try to pickup anything that is not an item :)
LOGGER_PET.warning(this + " trying to pickup wrong target." + object);

View File

@@ -236,7 +236,7 @@ public final class L2ItemInstance extends 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>

View File

@@ -43,7 +43,7 @@ public class RequestExRqItemLink implements IClientIncomingPacket
if (client != null)
{
final L2Object object = L2World.getInstance().findObject(_objectId);
if (object instanceof L2ItemInstance)
if (object.isItem())
{
final L2ItemInstance item = (L2ItemInstance) object;
if (item.isPublished())

View File

@@ -43,7 +43,7 @@ public final class SpawnItem implements IClientOutgoingPacket
Thread.dumpStack(); // Why? Also check DropItem, just in case.
}
if (obj instanceof L2ItemInstance)
if (obj.isItem())
{
final L2ItemInstance item = (L2ItemInstance) obj;
_itemId = item.getDisplayId();