Remove death drops

Discussion in 'Plugin Development' started by ppodds, Jan 27, 2016.

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

    ppodds

    How to remove death drops?

    This is my code,but it doesn't work.
    Help......

    Code:
    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent event)
    {
        event.getDrops().clean();
    }
    
    
     
    Last edited: Jan 28, 2016
  2. Offline

    BobTheHamster9

    @ppodds
    Did you mean event.getDrops.clear();?
     
  3. Offline

    teej107

  4. Offline

    ppodds

    Yes

    But I want player drop items,and if they can't find it,clean drops.

    I have created the timer. The timer has triggered, but drops were not cleared.
     
    Last edited: Jan 28, 2016
  5. Offline

    JoaoBM

    @ppodds That already happens: items are cleared from the ground if they arent picked up (= they were not found).
    You could create a timer that starts when a player dies and when it hits 0 the items are cleared.
     
  6. Offline

    ppodds

    getDrops() --> List<ItemStack>

    So I think...

    Code:
    @EventHandler
        public void onItemSpawn(ItemSpawnEvent event)
        {
            event.getEntity().remove();
        }
    
    But it doesn't work,too.

    I find this at https://bukkit.org/threads/remove-drops-x-seconds-after-death.272522/
     
  7. Offline

    JoaoBM

    @ppodds Create like a sort of cooldown on EntityDeathEvent. When it reaches 0 the items are cleared.
     
  8. Offline

    ppodds

    I want to remove the player's drops when player die.
    So...why you use EntityDeathEvent?
     
  9. Offline

    teej107

    Don't use EntityDeathEvent. PlayerDeathEvent is what you need. You can "remove" their drops by
    Then you can have easy control on what happens to the items in their inventory.
     
  10. Offline

    JoaoBM

    @ppodds @teej107 My bad, wanted to say PlayerDeathEvent and wrote EntityDeathEvent.
     
  11. Offline

    ppodds

    I want to remove the player's drops "on the ground" when player die.
     
  12. Offline

    teej107

    @ppodds So you want the items to drop but then have them despawn right when they hit the ground?
     
  13. Offline

    ppodds

    Right!
     
    Last edited: Feb 4, 2016
Thread Status:
Not open for further replies.

Share This Page