#Getting Dropped Item Upon Death

1 messages · Page 1 of 1 (latest)

torn sphinx
#

Hey guys, I'm trying to get the items which are dropped when a player dies. The getDrops() in the PlayerDeathEvent returns a list of ItemStacks, but I specifically would want the Item values. Later I want to be able to prevent players from picking up those specific items for a few minutes. How would I go about doing that?

marble cedar
#

set a flag on the itemstack that prevents them being picked up

#

PersistentDataContainer in new versions, display name or similar in old versions

torn sphinx
#

Ah I forgot to mention: I want the original owner of the items to be able to pickup the items regardless, so simply disabling item pickup won't work...

marble cedar
#

set the owner in the data container / display name / lore etc and check it in the pickup event

vale mortar
#

Item has a setOwner

torn sphinx
#

Item does, ItemStack doesn't :)

vale mortar
#

Then yes, PDC

torn sphinx
#

never used that before, but I will give that a shot right now, thanks 👍