Prevent dropping custom item when a player dies?

Discussion in 'Plugin Development' started by EvilGooD, May 30, 2015.

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

    EvilGooD

    How I can cancel the event?
     
  2. Offline

    teej107

    What have you tried?
     
  3. Offline

    Rbt

    On a PlayerDeathEvent, do e.setKeepInventory(true); The player will then not drop items on death and will keep their inventory.
     
  4. Offline

    EvilGooD

    But I want to prevent a player drops a custom item when he dies, not all items :/
     
  5. Offline

    Rbt

    I'm not 100% sure about this, but I think you might be able to clear all items that are not the custom item and then set keepinventory to true. That way, the custom item stays.
     
  6. Offline

    Konato_K

    @EvilGooD As said, you can set them to keep their inventory, and manually drop the rest of their inventory but the desired item.

    Another way would be to remove the item when they die (so it doesn't drop) and give it back once they respawned
     
    EnchantedMiners likes this.
Thread Status:
Not open for further replies.

Share This Page