Add death drops to a list and remove off of ground later

Discussion in 'Plugin Development' started by Iran, Feb 22, 2018.

Thread Status:
Not open for further replies.
  1. Offline


    I want to remove player items off of the ground after a few minutes when they die but the drops are a ItemStack and I can't remove ItemStack off of ground, I can only remove Item. What should I do?
  2. Online

    timtower Moderator Moderator

    @Iran You get the position of the drop, then you find the Item's around it.
    ItemStack is internal code, Item is the in world object representing it.
  3. Offline


    is that the only way to do it? it seems kinda of iffy
  4. Online

    timtower Moderator Moderator

    You can probably also set an expiration tine, not 100% sure though.
  5. Offline


    Really weird that on the drop event it is an Entity, but the drops on player death are a ItemStack.
  6. Offline


    I believe its because it is just the raw object out of the inventory before it has become an entity.

    Essentially it executes PlayerDeath -> GetAllDrops -> DropEvent for each itemstack
  7. Offline


    This event might be called when the Items are spawned in, and if you have a list of the ItemStack, you an compare to the Item entity here. ItemSpawnEvent
  8. Offline


    compare what exactly? Does each ItemStack have some sort of ID?
  9. Offline


    You can use both the drop event and drop on death event. Check for the position of both events and if both events are fired at the same time with a simple if-statement. If both statements return true, simply use the dropitemevent to get the entities which you can remove later.
    I hope that helped!
Thread Status:
Not open for further replies.

Share This Page