Replaced instanceof L2PetInstance with isPet method.

This commit is contained in:
MobiusDev
2018-07-02 01:12:00 +00:00
parent 856ff5ebdc
commit e9e7d40628
19 changed files with 45 additions and 47 deletions

View File

@@ -598,7 +598,7 @@ public class AdminEditChar implements IAdminCommandHandler
else if (command.startsWith("admin_fullfood"))
{
final L2Object target = activeChar.getTarget();
if (target instanceof L2PetInstance)
if ((target != null) && target.isPet())
{
final L2PetInstance targetPet = (L2PetInstance) target;
targetPet.setCurrentFed(targetPet.getMaxFed());
@@ -767,7 +767,7 @@ public class AdminEditChar implements IAdminCommandHandler
else if (command.startsWith("admin_summon_setlvl"))
{
final L2Object target = activeChar.getTarget();
if (target instanceof L2PetInstance)
if ((target != null) && target.isPet())
{
final L2PetInstance pet = (L2PetInstance) target;
try
@@ -809,7 +809,7 @@ public class AdminEditChar implements IAdminCommandHandler
target = activeChar.getTarget();
}
if (target instanceof L2PetInstance)
if ((target != null) && target.isPet())
{
activeChar.sendPacket(new GMViewItemList((L2PetInstance) target));
}
@@ -1645,7 +1645,7 @@ public class AdminEditChar implements IAdminCommandHandler
{
html.replace("%inv%", "none");
}
if (target instanceof L2PetInstance)
if (target.isPet())
{
html.replace("%food%", ((L2PetInstance) target).getCurrentFed() + "/" + ((L2PetInstance) target).getPetLevelData().getPetMaxFeed());
html.replace("%load%", target.getInventory().getTotalWeight() + "/" + target.getMaxLoad());

View File

@@ -34,7 +34,7 @@ public class PetStatusUpdate implements IClientOutgoingPacket
public PetStatusUpdate(L2Summon summon)
{
_summon = summon;
if (_summon instanceof L2PetInstance)
if (_summon.isPet())
{
final L2PetInstance pet = (L2PetInstance) _summon;
_curFed = pet.getCurrentFed(); // how fed it is