Permanently store item owner in ItemInstance.
This commit is contained in:
@@ -99,8 +99,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;
|
||||
@@ -375,6 +376,7 @@ public class ItemInstance extends WorldObject
|
||||
// Remove any inventory skills from the old owner.
|
||||
removeSkillsFromOwner();
|
||||
|
||||
_owner = null;
|
||||
_ownerId = ownerId;
|
||||
_storedInDb = false;
|
||||
|
||||
@@ -1582,6 +1584,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());
|
||||
}
|
||||
@@ -2085,7 +2089,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