Permanently store item owner in ItemInstance.
This commit is contained in:
@ -102,8 +102,9 @@ public class ItemInstance extends WorldObject
|
||||
private static final Logger LOGGER = Logger.getLogger(ItemInstance.class.getName());
|
||||
private static final Logger LOG_ITEMS = Logger.getLogger("item");
|
||||
|
||||
/** ID of the owner */
|
||||
/** Owner */
|
||||
private int _ownerId;
|
||||
private PlayerInstance _owner;
|
||||
|
||||
/** ID of who dropped the item last, used for knownlist */
|
||||
private int _dropperObjectId = 0;
|
||||
@ -378,6 +379,7 @@ public class ItemInstance extends WorldObject
|
||||
// Remove any inventory skills from the old owner.
|
||||
removeSkillsFromOwner();
|
||||
|
||||
_owner = null;
|
||||
_ownerId = ownerId;
|
||||
_storedInDb = false;
|
||||
|
||||
@ -1590,6 +1592,8 @@ public class ItemInstance extends WorldObject
|
||||
ThreadPool.execute(new ItemDropTask(this, dropper, x, y, z));
|
||||
if ((dropper != null) && dropper.isPlayer())
|
||||
{
|
||||
_owner = null;
|
||||
|
||||
// Notify to scripts
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemDrop(dropper.getActingPlayer(), this, new Location(x, y, z)), getItem());
|
||||
}
|
||||
@ -2093,7 +2097,11 @@ public class ItemInstance extends WorldObject
|
||||
@Override
|
||||
public PlayerInstance getActingPlayer()
|
||||
{
|
||||
return World.getInstance().getPlayer(getOwnerId());
|
||||
if ((_owner == null) && (_ownerId != 0))
|
||||
{
|
||||
_owner = World.getInstance().getPlayer(_ownerId);
|
||||
}
|
||||
return _owner;
|
||||
}
|
||||
|
||||
public int getEquipReuseDelay()
|
||||
|
Reference in New Issue
Block a user