Solved How to check if damage is greater than player health

Discussion in 'Plugin Development' started by voltywolty, Nov 5, 2021.

  1. Offline


    I'm trying to make it where the player gets in spectator mode once the players health is 0, however, I do not want the player to actually die, just put them in spectator mode when the damage is greater than their health. How could I do this?
  2. Offline


    Just make a PlayerDeathEvent and once it is triggered you set the players health to 20 (which sort of cancels the event) and simply put them in spectator mode.
  3. Offline


    Catch entity damage event. Determine damage. Determine remaining HP. If damage > hp, cancel event and put player in spectator mode.

Share This Page