Force respawn? or cancel death event?

Discussion in 'Spigot Plugin Development' started by Bolt, Jun 22, 2015.

  1. Is there a way to cancel a death event or to force a player to respawn in a certain location? I'm thinking of simply teleporting them as soon as they respawn but I want to do something as soon as they die without the respawn screen showing up. Is there a way to do this?
     
  2. use a entity damage event, and check if the entity damaged is a player, and if the player will die when they get damaged, cancel the damage and tp them somewhere else with full health :)
     
    • Friendly Friendly x 1
  3. player.spigot().respawn() - Auto respawns a player on server's respawn location. Run your codes after that on PlayerDeathEvent.
     
    • Useful Useful x 3
  4. Serializator

    Supporter

    You could use the EntityDamageEvent and see if its an instance of Player and if the damage is greater or equal to the health of the entity, if so, reset health, hunger and teleport him to the preferred location.

    Didn't saw this already has been suggested, sorry.