From d806ff66e5033beca90f9f965268a0ad07726480 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sat, 30 Jun 2018 15:41:20 +0000 Subject: [PATCH] Replaced instanceof L2ItemInstance with isItem method. --- .../java/com/l2jmobius/gameserver/ai/L2CharacterAI.java | 4 ++-- .../java/com/l2jmobius/gameserver/model/TradeList.java | 2 +- .../gameserver/model/actor/instance/L2PetInstance.java | 2 +- .../gameserver/model/items/instance/L2ItemInstance.java | 2 +- .../gameserver/network/clientpackets/RequestDestroyItem.java | 2 +- .../gameserver/network/clientpackets/RequestExRqItemLink.java | 2 +- .../l2jmobius/gameserver/network/clientpackets/UseItem.java | 2 +- .../java/com/l2jmobius/gameserver/ai/L2CharacterAI.java | 4 ++-- .../java/com/l2jmobius/gameserver/model/TradeList.java | 2 +- .../gameserver/model/actor/instance/L2PetInstance.java | 2 +- .../gameserver/model/items/instance/L2ItemInstance.java | 2 +- .../gameserver/network/clientpackets/RequestDestroyItem.java | 2 +- .../gameserver/network/clientpackets/RequestExRqItemLink.java | 2 +- .../l2jmobius/gameserver/network/clientpackets/UseItem.java | 2 +- .../java/com/l2jmobius/gameserver/ai/L2CharacterAI.java | 4 ++-- .../java/com/l2jmobius/gameserver/model/TradeList.java | 2 +- .../gameserver/model/actor/instance/L2PetInstance.java | 2 +- .../gameserver/model/items/instance/L2ItemInstance.java | 2 +- .../gameserver/network/clientpackets/RequestDestroyItem.java | 2 +- .../gameserver/network/clientpackets/RequestExRqItemLink.java | 2 +- .../l2jmobius/gameserver/network/clientpackets/UseItem.java | 2 +- .../java/com/l2jmobius/gameserver/ai/L2CharacterAI.java | 4 ++-- .../java/com/l2jmobius/gameserver/model/TradeList.java | 2 +- .../gameserver/model/actor/instance/L2PetInstance.java | 2 +- .../gameserver/model/items/instance/L2ItemInstance.java | 2 +- .../gameserver/network/clientpackets/RequestDestroyItem.java | 2 +- .../gameserver/network/clientpackets/RequestExRqItemLink.java | 2 +- .../l2jmobius/gameserver/network/clientpackets/UseItem.java | 2 +- .../java/com/l2jmobius/gameserver/ai/L2CharacterAI.java | 2 +- .../java/com/l2jmobius/gameserver/model/L2Object.java | 4 ++-- .../java/com/l2jmobius/gameserver/model/TradeList.java | 4 ++-- .../gameserver/model/actor/instance/L2PcInstance.java | 2 +- .../gameserver/model/actor/instance/L2PetInstance.java | 2 +- .../gameserver/model/actor/knownlist/PcKnownList.java | 2 +- .../gameserver/network/clientpackets/RequestRecordInfo.java | 2 +- .../gameserver/network/serverpackets/NpcInfoPoly.java | 3 +-- .../gameserver/network/serverpackets/SpawnItemPoly.java | 2 +- .../java/com/l2jmobius/log/filter/ItemFilter.java | 2 +- .../java/com/l2jmobius/status/GameStatusThread.java | 2 +- .../java/com/l2jmobius/gameserver/ai/L2CharacterAI.java | 2 +- .../java/com/l2jmobius/gameserver/model/TradeList.java | 2 +- .../gameserver/model/actor/instance/L2PetInstance.java | 2 +- .../gameserver/model/items/instance/L2ItemInstance.java | 2 +- .../gameserver/network/clientpackets/RequestExRqItemLink.java | 2 +- .../l2jmobius/gameserver/network/serverpackets/SpawnItem.java | 2 +- .../java/com/l2jmobius/gameserver/ai/L2CharacterAI.java | 4 ++-- .../java/com/l2jmobius/gameserver/model/TradeList.java | 2 +- .../gameserver/model/actor/instance/L2PetInstance.java | 2 +- .../gameserver/model/items/instance/L2ItemInstance.java | 2 +- .../gameserver/network/clientpackets/RequestDestroyItem.java | 2 +- .../gameserver/network/clientpackets/RequestExRqItemLink.java | 2 +- .../l2jmobius/gameserver/network/clientpackets/UseItem.java | 2 +- .../java/com/l2jmobius/gameserver/ai/L2CharacterAI.java | 4 ++-- .../java/com/l2jmobius/gameserver/model/TradeList.java | 2 +- .../gameserver/model/actor/instance/L2PetInstance.java | 2 +- .../gameserver/model/items/instance/L2ItemInstance.java | 2 +- .../gameserver/network/clientpackets/RequestDestroyItem.java | 2 +- .../gameserver/network/clientpackets/RequestExRqItemLink.java | 2 +- .../l2jmobius/gameserver/network/clientpackets/UseItem.java | 2 +- .../java/com/l2jmobius/gameserver/ai/L2CharacterAI.java | 4 ++-- .../java/com/l2jmobius/gameserver/model/TradeList.java | 2 +- .../gameserver/model/actor/instance/L2PetInstance.java | 2 +- .../gameserver/model/items/instance/L2ItemInstance.java | 2 +- .../gameserver/network/clientpackets/RequestDestroyItem.java | 2 +- .../gameserver/network/clientpackets/RequestExRqItemLink.java | 2 +- .../l2jmobius/gameserver/network/clientpackets/UseItem.java | 2 +- 66 files changed, 75 insertions(+), 76 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java index c5cda5a8c2..6a321f5974 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java @@ -460,7 +460,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; } @@ -980,7 +980,7 @@ public class L2CharacterAI extends AbstractAI } // 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(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/TradeList.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/TradeList.java index e31f0fb735..35bb3a225e 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/TradeList.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/TradeList.java @@ -182,7 +182,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; diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java index f1112eee76..c5b882a533 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java @@ -482,7 +482,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); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index 5b78228a88..b7ce8f840f 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -266,7 +266,7 @@ public final class L2ItemInstance extends L2Object *
* Assert :
*
- *
  • this instanceof L2ItemInstance
  • + *
  • this.isItem().
  • *
  • _worldRegion != null (L2Object is visible at the beginning)

  • *
    * Example of use :
    diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java index b6b85e45d9..297edda360 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java @@ -102,7 +102,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket if (activeChar.isGM()) { final L2Object obj = L2World.getInstance().findObject(_objectId); - if (obj instanceof L2ItemInstance) + if (obj.isItem()) { if (_count > ((L2ItemInstance) obj).getCount()) { diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java index 41c6a7e328..369014f1de 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java @@ -41,7 +41,7 @@ public class RequestExRqItemLink implements IClientIncomingPacket public void run(L2GameClient client) { final L2Object object = L2World.getInstance().findObject(_objectId); - if (object instanceof L2ItemInstance) + if (object.isItem()) { final L2ItemInstance item = (L2ItemInstance) object; if (item.isPublished()) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java index 21a4419169..d7e1ef6419 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -94,7 +94,7 @@ public final class UseItem implements IClientIncomingPacket if (activeChar.isGM()) { final L2Object obj = L2World.getInstance().findObject(_objectId); - if (obj instanceof L2ItemInstance) + if (obj.isItem()) { AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true); } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java index c5cda5a8c2..6a321f5974 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java @@ -460,7 +460,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; } @@ -980,7 +980,7 @@ public class L2CharacterAI extends AbstractAI } // 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(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/TradeList.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/TradeList.java index e31f0fb735..35bb3a225e 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/TradeList.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/TradeList.java @@ -182,7 +182,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; diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java index f1112eee76..c5b882a533 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java @@ -482,7 +482,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); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index 7522392d47..2052a72ab1 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -273,7 +273,7 @@ public final class L2ItemInstance extends L2Object *
    * Assert :
    *
    - *
  • this instanceof L2ItemInstance
  • + *
  • this.isItem().
  • *
  • _worldRegion != null (L2Object is visible at the beginning)

  • *
    * Example of use :
    diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java index b6b85e45d9..297edda360 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java @@ -102,7 +102,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket if (activeChar.isGM()) { final L2Object obj = L2World.getInstance().findObject(_objectId); - if (obj instanceof L2ItemInstance) + if (obj.isItem()) { if (_count > ((L2ItemInstance) obj).getCount()) { diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java index 41c6a7e328..369014f1de 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java @@ -41,7 +41,7 @@ public class RequestExRqItemLink implements IClientIncomingPacket public void run(L2GameClient client) { final L2Object object = L2World.getInstance().findObject(_objectId); - if (object instanceof L2ItemInstance) + if (object.isItem()) { final L2ItemInstance item = (L2ItemInstance) object; if (item.isPublished()) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java index 21a4419169..d7e1ef6419 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -94,7 +94,7 @@ public final class UseItem implements IClientIncomingPacket if (activeChar.isGM()) { final L2Object obj = L2World.getInstance().findObject(_objectId); - if (obj instanceof L2ItemInstance) + if (obj.isItem()) { AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true); } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java index c5cda5a8c2..6a321f5974 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java @@ -460,7 +460,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; } @@ -980,7 +980,7 @@ public class L2CharacterAI extends AbstractAI } // 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(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/TradeList.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/TradeList.java index e31f0fb735..35bb3a225e 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/TradeList.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/TradeList.java @@ -182,7 +182,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; diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java index f1112eee76..c5b882a533 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java @@ -482,7 +482,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); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index 7522392d47..2052a72ab1 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -273,7 +273,7 @@ public final class L2ItemInstance extends L2Object *
    * Assert :
    *
    - *
  • this instanceof L2ItemInstance
  • + *
  • this.isItem().
  • *
  • _worldRegion != null (L2Object is visible at the beginning)

  • *
    * Example of use :
    diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java index b6b85e45d9..297edda360 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java @@ -102,7 +102,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket if (activeChar.isGM()) { final L2Object obj = L2World.getInstance().findObject(_objectId); - if (obj instanceof L2ItemInstance) + if (obj.isItem()) { if (_count > ((L2ItemInstance) obj).getCount()) { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java index 41c6a7e328..369014f1de 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java @@ -41,7 +41,7 @@ public class RequestExRqItemLink implements IClientIncomingPacket public void run(L2GameClient client) { final L2Object object = L2World.getInstance().findObject(_objectId); - if (object instanceof L2ItemInstance) + if (object.isItem()) { final L2ItemInstance item = (L2ItemInstance) object; if (item.isPublished()) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java index 21a4419169..d7e1ef6419 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -94,7 +94,7 @@ public final class UseItem implements IClientIncomingPacket if (activeChar.isGM()) { final L2Object obj = L2World.getInstance().findObject(_objectId); - if (obj instanceof L2ItemInstance) + if (obj.isItem()) { AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true); } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java index c5cda5a8c2..6a321f5974 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java @@ -460,7 +460,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; } @@ -980,7 +980,7 @@ public class L2CharacterAI extends AbstractAI } // 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(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/TradeList.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/TradeList.java index cbdb625d6c..46aba4c60c 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/TradeList.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/TradeList.java @@ -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; diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java index f1112eee76..c5b882a533 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java @@ -482,7 +482,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); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index 7522392d47..2052a72ab1 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -273,7 +273,7 @@ public final class L2ItemInstance extends L2Object *
    * Assert :
    *
    - *
  • this instanceof L2ItemInstance
  • + *
  • this.isItem().
  • *
  • _worldRegion != null (L2Object is visible at the beginning)

  • *
    * Example of use :
    diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java index b6b85e45d9..297edda360 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java @@ -102,7 +102,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket if (activeChar.isGM()) { final L2Object obj = L2World.getInstance().findObject(_objectId); - if (obj instanceof L2ItemInstance) + if (obj.isItem()) { if (_count > ((L2ItemInstance) obj).getCount()) { diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java index 41c6a7e328..369014f1de 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java @@ -41,7 +41,7 @@ public class RequestExRqItemLink implements IClientIncomingPacket public void run(L2GameClient client) { final L2Object object = L2World.getInstance().findObject(_objectId); - if (object instanceof L2ItemInstance) + if (object.isItem()) { final L2ItemInstance item = (L2ItemInstance) object; if (item.isPublished()) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java index 21a4419169..d7e1ef6419 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -94,7 +94,7 @@ public final class UseItem implements IClientIncomingPacket if (activeChar.isGM()) { final L2Object obj = L2World.getInstance().findObject(_objectId); - if (obj instanceof L2ItemInstance) + if (obj.isItem()) { AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true); } diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java index 634d41614e..b34d728bae 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java @@ -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(); diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2Object.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2Object.java index 524c6a181e..4a374b1fc2 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2Object.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2Object.java @@ -297,7 +297,7 @@ public abstract class L2Object *
    * Assert :
    *
    - *
  • this instanceof L2ItemInstance
  • + *
  • this.isItem().
  • *
  • _worldRegion != null (L2Object is visible at the beginning)

  • *
    * Example of use :
    @@ -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) diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/TradeList.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/TradeList.java index aad326f68c..d0401336f2 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/TradeList.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/TradeList.java @@ -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); diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index ee6a03aaef..607bf8c662 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -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()); diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java index a0e659f495..022ed418fc 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java @@ -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); diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/knownlist/PcKnownList.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/knownlist/PcKnownList.java index 4a15f7f6d0..61e50d9982 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/knownlist/PcKnownList.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/knownlist/PcKnownList.java @@ -120,7 +120,7 @@ public class PcKnownList extends PlayableKnownList } else { - if (object instanceof L2ItemInstance) + if (object.isItem()) { if (dropper != null) { diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestRecordInfo.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestRecordInfo.java index fee353522d..999dffd24c 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestRecordInfo.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestRecordInfo.java @@ -84,7 +84,7 @@ public class RequestRecordInfo extends L2GameClientPacket } else { - if (object instanceof L2ItemInstance) + if (object.isItem()) { _activeChar.sendPacket(new SpawnItem((L2ItemInstance) object)); } diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/serverpackets/NpcInfoPoly.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/serverpackets/NpcInfoPoly.java index bf02f00f81..e765165e7c 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/serverpackets/NpcInfoPoly.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/serverpackets/NpcInfoPoly.java @@ -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(); diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/serverpackets/SpawnItemPoly.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/serverpackets/SpawnItemPoly.java index 59ae4d4a21..ec91c5bdd7 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/serverpackets/SpawnItemPoly.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/serverpackets/SpawnItemPoly.java @@ -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(); diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/log/filter/ItemFilter.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/log/filter/ItemFilter.java index 17be491a11..f10276c000 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/log/filter/ItemFilter.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/log/filter/ItemFilter.java @@ -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]; diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/status/GameStatusThread.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/status/GameStatusThread.java index 7650257bd4..d2688468dc 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/status/GameStatusThread.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/status/GameStatusThread.java @@ -1104,7 +1104,7 @@ public class GameStatusThread extends Thread AICount++; } } - if (obj instanceof L2ItemInstance) + if (obj.isItem()) { if (((L2ItemInstance) obj).getLocation() == L2ItemInstance.ItemLocation.VOID) { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java index b7343930d2..330bedb718 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java @@ -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; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/TradeList.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/TradeList.java index d8d5e33cf6..13c73f3ea4 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/TradeList.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/TradeList.java @@ -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; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java index 1415202ce2..faefa9139a 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java @@ -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); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index d30136ae8f..bdea062b9e 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -236,7 +236,7 @@ public final class L2ItemInstance extends L2Object *
    * Assert :
    *
    - *
  • this instanceof L2ItemInstance
  • + *
  • this.isItem().
  • *
  • _worldRegion != null (L2Object is visible at the beginning)

  • *
    * Example of use :
    diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java index 57227cabf4..9d3bcb9fd4 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java @@ -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()) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/SpawnItem.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/SpawnItem.java index 4f594fca24..3b9267a72f 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/SpawnItem.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/SpawnItem.java @@ -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(); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java index 97947f6b90..ead049188a 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java @@ -460,7 +460,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; } @@ -980,7 +980,7 @@ public class L2CharacterAI extends AbstractAI } // 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(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/TradeList.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/TradeList.java index e31f0fb735..35bb3a225e 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/TradeList.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/TradeList.java @@ -182,7 +182,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; diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java index f1112eee76..c5b882a533 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java @@ -482,7 +482,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); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index 7522392d47..2052a72ab1 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -273,7 +273,7 @@ public final class L2ItemInstance extends L2Object *
    * Assert :
    *
    - *
  • this instanceof L2ItemInstance
  • + *
  • this.isItem().
  • *
  • _worldRegion != null (L2Object is visible at the beginning)

  • *
    * Example of use :
    diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java index b6b85e45d9..297edda360 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java @@ -102,7 +102,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket if (activeChar.isGM()) { final L2Object obj = L2World.getInstance().findObject(_objectId); - if (obj instanceof L2ItemInstance) + if (obj.isItem()) { if (_count > ((L2ItemInstance) obj).getCount()) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java index 41c6a7e328..369014f1de 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java @@ -41,7 +41,7 @@ public class RequestExRqItemLink implements IClientIncomingPacket public void run(L2GameClient client) { final L2Object object = L2World.getInstance().findObject(_objectId); - if (object instanceof L2ItemInstance) + if (object.isItem()) { final L2ItemInstance item = (L2ItemInstance) object; if (item.isPublished()) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java index 21a4419169..d7e1ef6419 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -94,7 +94,7 @@ public final class UseItem implements IClientIncomingPacket if (activeChar.isGM()) { final L2Object obj = L2World.getInstance().findObject(_objectId); - if (obj instanceof L2ItemInstance) + if (obj.isItem()) { AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true); } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java index 97947f6b90..ead049188a 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java @@ -460,7 +460,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; } @@ -980,7 +980,7 @@ public class L2CharacterAI extends AbstractAI } // 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(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/TradeList.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/TradeList.java index cbdb625d6c..46aba4c60c 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/TradeList.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/TradeList.java @@ -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; diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java index f1112eee76..c5b882a533 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java @@ -482,7 +482,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); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index 7522392d47..2052a72ab1 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -273,7 +273,7 @@ public final class L2ItemInstance extends L2Object *
    * Assert :
    *
    - *
  • this instanceof L2ItemInstance
  • + *
  • this.isItem().
  • *
  • _worldRegion != null (L2Object is visible at the beginning)

  • *
    * Example of use :
    diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java index b6b85e45d9..297edda360 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java @@ -102,7 +102,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket if (activeChar.isGM()) { final L2Object obj = L2World.getInstance().findObject(_objectId); - if (obj instanceof L2ItemInstance) + if (obj.isItem()) { if (_count > ((L2ItemInstance) obj).getCount()) { diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java index 41c6a7e328..369014f1de 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java @@ -41,7 +41,7 @@ public class RequestExRqItemLink implements IClientIncomingPacket public void run(L2GameClient client) { final L2Object object = L2World.getInstance().findObject(_objectId); - if (object instanceof L2ItemInstance) + if (object.isItem()) { final L2ItemInstance item = (L2ItemInstance) object; if (item.isPublished()) diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java index 21a4419169..d7e1ef6419 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -94,7 +94,7 @@ public final class UseItem implements IClientIncomingPacket if (activeChar.isGM()) { final L2Object obj = L2World.getInstance().findObject(_objectId); - if (obj instanceof L2ItemInstance) + if (obj.isItem()) { AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true); } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java index 97947f6b90..ead049188a 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java @@ -460,7 +460,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; } @@ -980,7 +980,7 @@ public class L2CharacterAI extends AbstractAI } // 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(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/TradeList.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/TradeList.java index cbdb625d6c..46aba4c60c 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/TradeList.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/TradeList.java @@ -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; diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java index f1112eee76..c5b882a533 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java @@ -482,7 +482,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); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index 7522392d47..2052a72ab1 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -273,7 +273,7 @@ public final class L2ItemInstance extends L2Object *
    * Assert :
    *
    - *
  • this instanceof L2ItemInstance
  • + *
  • this.isItem().
  • *
  • _worldRegion != null (L2Object is visible at the beginning)

  • *
    * Example of use :
    diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java index b6b85e45d9..297edda360 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java @@ -102,7 +102,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket if (activeChar.isGM()) { final L2Object obj = L2World.getInstance().findObject(_objectId); - if (obj instanceof L2ItemInstance) + if (obj.isItem()) { if (_count > ((L2ItemInstance) obj).getCount()) { diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java index 41c6a7e328..369014f1de 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestExRqItemLink.java @@ -41,7 +41,7 @@ public class RequestExRqItemLink implements IClientIncomingPacket public void run(L2GameClient client) { final L2Object object = L2World.getInstance().findObject(_objectId); - if (object instanceof L2ItemInstance) + if (object.isItem()) { final L2ItemInstance item = (L2ItemInstance) object; if (item.isPublished()) diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java index 21a4419169..d7e1ef6419 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -94,7 +94,7 @@ public final class UseItem implements IClientIncomingPacket if (activeChar.isGM()) { final L2Object obj = L2World.getInstance().findObject(_objectId); - if (obj instanceof L2ItemInstance) + if (obj.isItem()) { AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_use_item " + _objectId, true); }