ItemDrop

Discussion in 'Plugin Development' started by __ImTheMoney__, Sep 15, 2013.

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

    __ImTheMoney__

    how do i make it so that if somebody dies he will not drop the items??
     
  2. Offline

    Hollasch

    Code:java
    1. @EventHandler
    2. public void playerDamage(EntityDamageEvent event)
    3. {
    4. if (event.getEntity() instanceof Player)
    5. {
    6. Player player = (Player)event.getEntity();
    7. if (player.getHealth() - event.getDamage() <= 0)
    8. {
    9. player.getInventory().clear();
    10. }
    11. }
    12. }


    Should work, I might be wrong (=
     
  3. Offline

    Benatat12

    Listen to the PlayerDeathEvent, call event.getDrops().clear();
     
Thread Status:
Not open for further replies.

Share This Page