In a map I'm building, I want players to always have full health, no matter what damages them, as long as it doesn't kill them. That is, when they get 19.5 hearts worth of damage, their health will instantly refill, but when they get 20 hearts damage at once, they die. I already tried doing
/effect @p minecraft:regeneration 100000 255
This only regenerates the health fast, not instantly. How can I do this?