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

@@ -460,7 +460,7 @@ public class L2CharacterAI extends AbstractAI
// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast) // Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
clientStopAutoAttack(); clientStopAutoAttack();
if ((object instanceof L2ItemInstance) && (((L2ItemInstance) object).getItemLocation() != ItemLocation.VOID)) if (object.isItem() && (((L2ItemInstance) object).getItemLocation() != ItemLocation.VOID))
{ {
return; return;
} }
@@ -980,7 +980,7 @@ public class L2CharacterAI extends AbstractAI
} }
// while flying there is no move to cast // while flying there is no move to cast
if (_actor.getAI().getIntention() == AI_INTENTION_CAST && _actor.isPlayer() && _actor.checkTransformed(transform -> !transform.isCombat())) if ((_actor.getAI().getIntention() == AI_INTENTION_CAST) && _actor.isPlayer() && _actor.checkTransformed(transform -> !transform.isCombat()))
{ {
_actor.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_STOPPED); _actor.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_STOPPED);
_actor.sendPacket(ActionFailed.STATIC_PACKET); _actor.sendPacket(ActionFailed.STATIC_PACKET);

View File

@@ -182,7 +182,7 @@ public class TradeList
} }
final L2Object o = L2World.getInstance().findObject(objectId); 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!"); LOGGER.warning(_owner.getName() + ": Trying to add something other than an item!");
return null; return null;

View File

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

View File

@@ -266,7 +266,7 @@ public final class L2ItemInstance extends L2Object
* <BR> * <BR>
* <B><U> Assert </U> :</B><BR> * <B><U> Assert </U> :</B><BR>
* <BR> * <BR>
* <li>this instanceof L2ItemInstance</li> * <li>this.isItem().</li>
* <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR> * <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR>
* <BR> * <BR>
* <B><U> Example of use </U> :</B><BR> * <B><U> Example of use </U> :</B><BR>

View File

@@ -102,7 +102,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket
if (activeChar.isGM()) if (activeChar.isGM())
{ {
final L2Object obj = L2World.getInstance().findObject(_objectId); final L2Object obj = L2World.getInstance().findObject(_objectId);
if (obj instanceof L2ItemInstance) if (obj.isItem())
{ {
if (_count > ((L2ItemInstance) obj).getCount()) if (_count > ((L2ItemInstance) obj).getCount())
{ {

View File

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

View File

@@ -94,7 +94,7 @@ public final class UseItem implements IClientIncomingPacket
if (activeChar.isGM()) if (activeChar.isGM())
{ {
final L2Object obj = L2World.getInstance().findObject(_objectId); final L2Object obj = L2World.getInstance().findObject(_objectId);
if (obj instanceof L2ItemInstance) if (obj.isItem())
{ {
AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true); AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true);
} }

View File

@@ -460,7 +460,7 @@ public class L2CharacterAI extends AbstractAI
// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast) // Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
clientStopAutoAttack(); clientStopAutoAttack();
if ((object instanceof L2ItemInstance) && (((L2ItemInstance) object).getItemLocation() != ItemLocation.VOID)) if (object.isItem() && (((L2ItemInstance) object).getItemLocation() != ItemLocation.VOID))
{ {
return; return;
} }
@@ -980,7 +980,7 @@ public class L2CharacterAI extends AbstractAI
} }
// while flying there is no move to cast // while flying there is no move to cast
if (_actor.getAI().getIntention() == AI_INTENTION_CAST && _actor.isPlayer() && _actor.checkTransformed(transform -> !transform.isCombat())) if ((_actor.getAI().getIntention() == AI_INTENTION_CAST) && _actor.isPlayer() && _actor.checkTransformed(transform -> !transform.isCombat()))
{ {
_actor.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_STOPPED); _actor.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_STOPPED);
_actor.sendPacket(ActionFailed.STATIC_PACKET); _actor.sendPacket(ActionFailed.STATIC_PACKET);

View File

@@ -182,7 +182,7 @@ public class TradeList
} }
final L2Object o = L2World.getInstance().findObject(objectId); 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!"); LOGGER.warning(_owner.getName() + ": Trying to add something other than an item!");
return null; return null;

View File

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

View File

@@ -273,7 +273,7 @@ public final class L2ItemInstance extends L2Object
* <BR> * <BR>
* <B><U> Assert </U> :</B><BR> * <B><U> Assert </U> :</B><BR>
* <BR> * <BR>
* <li>this instanceof L2ItemInstance</li> * <li>this.isItem().</li>
* <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR> * <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR>
* <BR> * <BR>
* <B><U> Example of use </U> :</B><BR> * <B><U> Example of use </U> :</B><BR>

View File

@@ -102,7 +102,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket
if (activeChar.isGM()) if (activeChar.isGM())
{ {
final L2Object obj = L2World.getInstance().findObject(_objectId); final L2Object obj = L2World.getInstance().findObject(_objectId);
if (obj instanceof L2ItemInstance) if (obj.isItem())
{ {
if (_count > ((L2ItemInstance) obj).getCount()) if (_count > ((L2ItemInstance) obj).getCount())
{ {

View File

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

View File

@@ -94,7 +94,7 @@ public final class UseItem implements IClientIncomingPacket
if (activeChar.isGM()) if (activeChar.isGM())
{ {
final L2Object obj = L2World.getInstance().findObject(_objectId); final L2Object obj = L2World.getInstance().findObject(_objectId);
if (obj instanceof L2ItemInstance) if (obj.isItem())
{ {
AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true); AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true);
} }

View File

@@ -460,7 +460,7 @@ public class L2CharacterAI extends AbstractAI
// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast) // Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
clientStopAutoAttack(); clientStopAutoAttack();
if ((object instanceof L2ItemInstance) && (((L2ItemInstance) object).getItemLocation() != ItemLocation.VOID)) if (object.isItem() && (((L2ItemInstance) object).getItemLocation() != ItemLocation.VOID))
{ {
return; return;
} }
@@ -980,7 +980,7 @@ public class L2CharacterAI extends AbstractAI
} }
// while flying there is no move to cast // while flying there is no move to cast
if (_actor.getAI().getIntention() == AI_INTENTION_CAST && _actor.isPlayer() && _actor.checkTransformed(transform -> !transform.isCombat())) if ((_actor.getAI().getIntention() == AI_INTENTION_CAST) && _actor.isPlayer() && _actor.checkTransformed(transform -> !transform.isCombat()))
{ {
_actor.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_STOPPED); _actor.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_STOPPED);
_actor.sendPacket(ActionFailed.STATIC_PACKET); _actor.sendPacket(ActionFailed.STATIC_PACKET);

View File

@@ -182,7 +182,7 @@ public class TradeList
} }
final L2Object o = L2World.getInstance().findObject(objectId); 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!"); LOGGER.warning(_owner.getName() + ": Trying to add something other than an item!");
return null; return null;

View File

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

View File

@@ -273,7 +273,7 @@ public final class L2ItemInstance extends L2Object
* <BR> * <BR>
* <B><U> Assert </U> :</B><BR> * <B><U> Assert </U> :</B><BR>
* <BR> * <BR>
* <li>this instanceof L2ItemInstance</li> * <li>this.isItem().</li>
* <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR> * <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR>
* <BR> * <BR>
* <B><U> Example of use </U> :</B><BR> * <B><U> Example of use </U> :</B><BR>

View File

@@ -102,7 +102,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket
if (activeChar.isGM()) if (activeChar.isGM())
{ {
final L2Object obj = L2World.getInstance().findObject(_objectId); final L2Object obj = L2World.getInstance().findObject(_objectId);
if (obj instanceof L2ItemInstance) if (obj.isItem())
{ {
if (_count > ((L2ItemInstance) obj).getCount()) if (_count > ((L2ItemInstance) obj).getCount())
{ {

View File

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

View File

@@ -94,7 +94,7 @@ public final class UseItem implements IClientIncomingPacket
if (activeChar.isGM()) if (activeChar.isGM())
{ {
final L2Object obj = L2World.getInstance().findObject(_objectId); final L2Object obj = L2World.getInstance().findObject(_objectId);
if (obj instanceof L2ItemInstance) if (obj.isItem())
{ {
AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true); AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true);
} }

View File

@@ -460,7 +460,7 @@ public class L2CharacterAI extends AbstractAI
// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast) // Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
clientStopAutoAttack(); clientStopAutoAttack();
if ((object instanceof L2ItemInstance) && (((L2ItemInstance) object).getItemLocation() != ItemLocation.VOID)) if (object.isItem() && (((L2ItemInstance) object).getItemLocation() != ItemLocation.VOID))
{ {
return; return;
} }
@@ -980,7 +980,7 @@ public class L2CharacterAI extends AbstractAI
} }
// while flying there is no move to cast // while flying there is no move to cast
if (_actor.getAI().getIntention() == AI_INTENTION_CAST && _actor.isPlayer() && _actor.checkTransformed(transform -> !transform.isCombat())) if ((_actor.getAI().getIntention() == AI_INTENTION_CAST) && _actor.isPlayer() && _actor.checkTransformed(transform -> !transform.isCombat()))
{ {
_actor.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_STOPPED); _actor.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_STOPPED);
_actor.sendPacket(ActionFailed.STATIC_PACKET); _actor.sendPacket(ActionFailed.STATIC_PACKET);

View File

@@ -184,7 +184,7 @@ public class TradeList
} }
final L2Object o = L2World.getInstance().findObject(objectId); 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!"); LOGGER.warning(_owner.getName() + ": Trying to add something other than an item!");
return null; return null;

View File

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

View File

@@ -273,7 +273,7 @@ public final class L2ItemInstance extends L2Object
* <BR> * <BR>
* <B><U> Assert </U> :</B><BR> * <B><U> Assert </U> :</B><BR>
* <BR> * <BR>
* <li>this instanceof L2ItemInstance</li> * <li>this.isItem().</li>
* <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR> * <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR>
* <BR> * <BR>
* <B><U> Example of use </U> :</B><BR> * <B><U> Example of use </U> :</B><BR>

View File

@@ -102,7 +102,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket
if (activeChar.isGM()) if (activeChar.isGM())
{ {
final L2Object obj = L2World.getInstance().findObject(_objectId); final L2Object obj = L2World.getInstance().findObject(_objectId);
if (obj instanceof L2ItemInstance) if (obj.isItem())
{ {
if (_count > ((L2ItemInstance) obj).getCount()) if (_count > ((L2ItemInstance) obj).getCount())
{ {

View File

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

View File

@@ -94,7 +94,7 @@ public final class UseItem implements IClientIncomingPacket
if (activeChar.isGM()) if (activeChar.isGM())
{ {
final L2Object obj = L2World.getInstance().findObject(_objectId); final L2Object obj = L2World.getInstance().findObject(_objectId);
if (obj instanceof L2ItemInstance) if (obj.isItem())
{ {
AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true); AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true);
} }

View File

@@ -507,7 +507,7 @@ public class L2CharacterAI extends AbstractAI
return; 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 // Cancel action client side by sending Server->Client packet ActionFailed to the L2PcInstance actor
clientActionFailed(); clientActionFailed();

View File

@@ -297,7 +297,7 @@ public abstract class L2Object
* <BR> * <BR>
* <B><U> Assert </U> :</B><BR> * <B><U> Assert </U> :</B><BR>
* <BR> * <BR>
* <li>this instanceof L2ItemInstance</li> * <li>this.isItem().</li>
* <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li> <BR> * <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li> <BR>
* <BR> * <BR>
* <B><U> Example of use </U> :</B><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 item is a mercenary ticket, remove the spawns!
if (this instanceof L2ItemInstance) if (isItem())
{ {
final int itemId = ((L2ItemInstance) this).getItemId(); final int itemId = ((L2ItemInstance) this).getItemId();
if (MercTicketManager.getInstance().getTicketCastleId(itemId) > 0) if (MercTicketManager.getInstance().getTicketCastleId(itemId) > 0)

View File

@@ -339,7 +339,7 @@ public class TradeList
L2Object o = L2World.getInstance().findObject(objectId); 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); 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!"); 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()); 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!"; 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); Util.handleIllegalPlayerAction(_owner, msgErr, Config.DEFAULT_PUNISH);

View File

@@ -6647,7 +6647,7 @@ public final class L2PcInstance extends L2Playable
getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
// Check if the L2Object to pick up is a L2ItemInstance // 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 :) // dont try to pickup anything that is not an item :)
LOGGER.warning(this + "trying to pickup wrong target." + getTarget()); LOGGER.warning(this + "trying to pickup wrong target." + getTarget());

View File

@@ -558,7 +558,7 @@ public class L2PetInstance extends L2Summon
broadcastPacket(sm); broadcastPacket(sm);
if (!(object instanceof L2ItemInstance)) if (!object.isItem())
{ {
// dont try to pickup anything that is not an item :) // dont try to pickup anything that is not an item :)
LOGGER.warning("Trying to pickup wrong target." + object); LOGGER.warning("Trying to pickup wrong target." + object);

View File

@@ -120,7 +120,7 @@ public class PcKnownList extends PlayableKnownList
} }
else else
{ {
if (object instanceof L2ItemInstance) if (object.isItem())
{ {
if (dropper != null) if (dropper != null)
{ {

View File

@@ -84,7 +84,7 @@ public class RequestRecordInfo extends L2GameClientPacket
} }
else else
{ {
if (object instanceof L2ItemInstance) if (object.isItem())
{ {
_activeChar.sendPacket(new SpawnItem((L2ItemInstance) object)); _activeChar.sendPacket(new SpawnItem((L2ItemInstance) object));
} }

View File

@@ -19,7 +19,6 @@ package com.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.datatables.sql.NpcTable; import com.l2jmobius.gameserver.datatables.sql.NpcTable;
import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2ItemInstance;
import com.l2jmobius.gameserver.templates.chars.L2NpcTemplate; import com.l2jmobius.gameserver.templates.chars.L2NpcTemplate;
/** /**
@@ -99,7 +98,7 @@ public class NpcInfoPoly extends L2GameServerPacket
_lhand = _template.lhand; _lhand = _template.lhand;
} }
if (_obj instanceof L2ItemInstance) if (_obj.isItem())
{ {
_x = _obj.getX(); _x = _obj.getX();
_y = _obj.getY(); _y = _obj.getY();

View File

@@ -32,7 +32,7 @@ public class SpawnItemPoly extends L2GameServerPacket
public SpawnItemPoly(L2Object object) public SpawnItemPoly(L2Object object)
{ {
if (object instanceof L2ItemInstance) if (object.isItem())
{ {
final L2ItemInstance item = (L2ItemInstance) object; final L2ItemInstance item = (L2ItemInstance) object;
_objectId = object.getObjectId(); _objectId = object.getObjectId();

View File

@@ -53,7 +53,7 @@ public class ItemFilter implements Filter
} }
if (_excludeItemType != null) 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; // return true;
final L2ItemInstance item = (L2ItemInstance) record.getParameters()[0]; final L2ItemInstance item = (L2ItemInstance) record.getParameters()[0];

View File

@@ -1104,7 +1104,7 @@ public class GameStatusThread extends Thread
AICount++; AICount++;
} }
} }
if (obj instanceof L2ItemInstance) if (obj.isItem())
{ {
if (((L2ItemInstance) obj).getLocation() == L2ItemInstance.ItemLocation.VOID) if (((L2ItemInstance) obj).getLocation() == L2ItemInstance.ItemLocation.VOID)
{ {

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) // Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
clientStopAutoAttack(); clientStopAutoAttack();
if ((object instanceof L2ItemInstance) && (((L2ItemInstance) object).getItemLocation() != ItemLocation.VOID)) if (object.isItem() && (((L2ItemInstance) object).getItemLocation() != ItemLocation.VOID))
{ {
return; return;
} }

View File

@@ -184,7 +184,7 @@ public class TradeList
} }
final L2Object o = L2World.getInstance().findObject(objectId); 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!"); LOGGER.warning(_owner.getName() + ": Trying to add something other than an item!");
return null; return null;

View File

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

View File

@@ -236,7 +236,7 @@ public final class L2ItemInstance extends L2Object
* <BR> * <BR>
* <B><U> Assert </U> :</B><BR> * <B><U> Assert </U> :</B><BR>
* <BR> * <BR>
* <li>this instanceof L2ItemInstance</li> * <li>this.isItem().</li>
* <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR> * <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR>
* <BR> * <BR>
* <B><U> Example of use </U> :</B><BR> * <B><U> Example of use </U> :</B><BR>

View File

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

View File

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

View File

@@ -460,7 +460,7 @@ public class L2CharacterAI extends AbstractAI
// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast) // Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
clientStopAutoAttack(); clientStopAutoAttack();
if ((object instanceof L2ItemInstance) && (((L2ItemInstance) object).getItemLocation() != ItemLocation.VOID)) if (object.isItem() && (((L2ItemInstance) object).getItemLocation() != ItemLocation.VOID))
{ {
return; return;
} }
@@ -980,7 +980,7 @@ public class L2CharacterAI extends AbstractAI
} }
// while flying there is no move to cast // while flying there is no move to cast
if (_actor.getAI().getIntention() == AI_INTENTION_CAST && _actor.isPlayer() && _actor.checkTransformed(transform -> !transform.isCombat())) if ((_actor.getAI().getIntention() == AI_INTENTION_CAST) && _actor.isPlayer() && _actor.checkTransformed(transform -> !transform.isCombat()))
{ {
_actor.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED); _actor.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
_actor.sendPacket(ActionFailed.STATIC_PACKET); _actor.sendPacket(ActionFailed.STATIC_PACKET);

View File

@@ -182,7 +182,7 @@ public class TradeList
} }
final L2Object o = L2World.getInstance().findObject(objectId); 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!"); LOGGER.warning(_owner.getName() + ": Trying to add something other than an item!");
return null; return null;

View File

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

View File

@@ -273,7 +273,7 @@ public final class L2ItemInstance extends L2Object
* <BR> * <BR>
* <B><U> Assert </U> :</B><BR> * <B><U> Assert </U> :</B><BR>
* <BR> * <BR>
* <li>this instanceof L2ItemInstance</li> * <li>this.isItem().</li>
* <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR> * <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR>
* <BR> * <BR>
* <B><U> Example of use </U> :</B><BR> * <B><U> Example of use </U> :</B><BR>

View File

@@ -102,7 +102,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket
if (activeChar.isGM()) if (activeChar.isGM())
{ {
final L2Object obj = L2World.getInstance().findObject(_objectId); final L2Object obj = L2World.getInstance().findObject(_objectId);
if (obj instanceof L2ItemInstance) if (obj.isItem())
{ {
if (_count > ((L2ItemInstance) obj).getCount()) if (_count > ((L2ItemInstance) obj).getCount())
{ {

View File

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

View File

@@ -94,7 +94,7 @@ public final class UseItem implements IClientIncomingPacket
if (activeChar.isGM()) if (activeChar.isGM())
{ {
final L2Object obj = L2World.getInstance().findObject(_objectId); final L2Object obj = L2World.getInstance().findObject(_objectId);
if (obj instanceof L2ItemInstance) if (obj.isItem())
{ {
AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true); AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true);
} }

View File

@@ -460,7 +460,7 @@ public class L2CharacterAI extends AbstractAI
// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast) // Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
clientStopAutoAttack(); clientStopAutoAttack();
if ((object instanceof L2ItemInstance) && (((L2ItemInstance) object).getItemLocation() != ItemLocation.VOID)) if (object.isItem() && (((L2ItemInstance) object).getItemLocation() != ItemLocation.VOID))
{ {
return; return;
} }
@@ -980,7 +980,7 @@ public class L2CharacterAI extends AbstractAI
} }
// while flying there is no move to cast // while flying there is no move to cast
if (_actor.getAI().getIntention() == AI_INTENTION_CAST && _actor.isPlayer() && _actor.checkTransformed(transform -> !transform.isCombat())) if ((_actor.getAI().getIntention() == AI_INTENTION_CAST) && _actor.isPlayer() && _actor.checkTransformed(transform -> !transform.isCombat()))
{ {
_actor.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED); _actor.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
_actor.sendPacket(ActionFailed.STATIC_PACKET); _actor.sendPacket(ActionFailed.STATIC_PACKET);

View File

@@ -184,7 +184,7 @@ public class TradeList
} }
final L2Object o = L2World.getInstance().findObject(objectId); 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!"); LOGGER.warning(_owner.getName() + ": Trying to add something other than an item!");
return null; return null;

View File

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

View File

@@ -273,7 +273,7 @@ public final class L2ItemInstance extends L2Object
* <BR> * <BR>
* <B><U> Assert </U> :</B><BR> * <B><U> Assert </U> :</B><BR>
* <BR> * <BR>
* <li>this instanceof L2ItemInstance</li> * <li>this.isItem().</li>
* <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR> * <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR>
* <BR> * <BR>
* <B><U> Example of use </U> :</B><BR> * <B><U> Example of use </U> :</B><BR>

View File

@@ -102,7 +102,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket
if (activeChar.isGM()) if (activeChar.isGM())
{ {
final L2Object obj = L2World.getInstance().findObject(_objectId); final L2Object obj = L2World.getInstance().findObject(_objectId);
if (obj instanceof L2ItemInstance) if (obj.isItem())
{ {
if (_count > ((L2ItemInstance) obj).getCount()) if (_count > ((L2ItemInstance) obj).getCount())
{ {

View File

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

View File

@@ -94,7 +94,7 @@ public final class UseItem implements IClientIncomingPacket
if (activeChar.isGM()) if (activeChar.isGM())
{ {
final L2Object obj = L2World.getInstance().findObject(_objectId); final L2Object obj = L2World.getInstance().findObject(_objectId);
if (obj instanceof L2ItemInstance) if (obj.isItem())
{ {
AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true); AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true);
} }

View File

@@ -460,7 +460,7 @@ public class L2CharacterAI extends AbstractAI
// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast) // Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
clientStopAutoAttack(); clientStopAutoAttack();
if ((object instanceof L2ItemInstance) && (((L2ItemInstance) object).getItemLocation() != ItemLocation.VOID)) if (object.isItem() && (((L2ItemInstance) object).getItemLocation() != ItemLocation.VOID))
{ {
return; return;
} }
@@ -980,7 +980,7 @@ public class L2CharacterAI extends AbstractAI
} }
// while flying there is no move to cast // while flying there is no move to cast
if (_actor.getAI().getIntention() == AI_INTENTION_CAST && _actor.isPlayer() && _actor.checkTransformed(transform -> !transform.isCombat())) if ((_actor.getAI().getIntention() == AI_INTENTION_CAST) && _actor.isPlayer() && _actor.checkTransformed(transform -> !transform.isCombat()))
{ {
_actor.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED); _actor.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
_actor.sendPacket(ActionFailed.STATIC_PACKET); _actor.sendPacket(ActionFailed.STATIC_PACKET);

View File

@@ -184,7 +184,7 @@ public class TradeList
} }
final L2Object o = L2World.getInstance().findObject(objectId); 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!"); LOGGER.warning(_owner.getName() + ": Trying to add something other than an item!");
return null; return null;

View File

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

View File

@@ -273,7 +273,7 @@ public final class L2ItemInstance extends L2Object
* <BR> * <BR>
* <B><U> Assert </U> :</B><BR> * <B><U> Assert </U> :</B><BR>
* <BR> * <BR>
* <li>this instanceof L2ItemInstance</li> * <li>this.isItem().</li>
* <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR> * <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR>
* <BR> * <BR>
* <B><U> Example of use </U> :</B><BR> * <B><U> Example of use </U> :</B><BR>

View File

@@ -102,7 +102,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket
if (activeChar.isGM()) if (activeChar.isGM())
{ {
final L2Object obj = L2World.getInstance().findObject(_objectId); final L2Object obj = L2World.getInstance().findObject(_objectId);
if (obj instanceof L2ItemInstance) if (obj.isItem())
{ {
if (_count > ((L2ItemInstance) obj).getCount()) if (_count > ((L2ItemInstance) obj).getCount())
{ {

View File

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

View File

@@ -94,7 +94,7 @@ public final class UseItem implements IClientIncomingPacket
if (activeChar.isGM()) if (activeChar.isGM())
{ {
final L2Object obj = L2World.getInstance().findObject(_objectId); final L2Object obj = L2World.getInstance().findObject(_objectId);
if (obj instanceof L2ItemInstance) if (obj.isItem())
{ {
AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true); AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true);
} }