Catch player before death

Discussion in 'Archived: Plugin Requests' started by Techtony96, Mar 22, 2013.

  1. Offline

    Techtony96

    First off, this is NOT a plugin, but a code snippit, that i need. Sorry if this is in the wrong thread, I couldn't find where else to put it.

    I need to teleport a player when he would die, but if they are in the respawn screen, they are technically not in the world, and an NPE is returned. So, I need to check when a player is damaged and see if they would die from that strike. If they would, heal them, and then teleport them to where ever. I can do the teleporting and healing, I just can't figure out how to check if a player is about to die.

    Thanks!
     
  2. Offline

    Scyntrus

    EntityDamageByEntityEvent

    Check the damage
    Check the hp remaining
    Compare.

    Btw this thread should go under plugin development.
     
  3. Offline

    Techtony96

    Scyntrus
    OK, i wasnt sure if it should go there since i was asking for stuff. I got it working!

    I didn't know there was a .getDamage()
     

Share This Page