Skip to content

Shared Max Health

For: advanced users stacking health bonuses.

Several modifiers sharing one player's max health through the ledger. The one-line forms live in the cheatsheet.

Tag Meaning
<pmaxhp.set:player,id,amount> Write exactly amount for that id, empty.
<pmaxhp.modify:player,id,delta> Add delta to that id (unset starts at 0), empty.
<pmaxhp.get:player,id> Read one id, 0 when unset.
<pmaxhp.clear:player,id> Drop one id (all entries when the id is omitted), empty.
<peliminated:player> Check after a write whether the player died from a lethal total.

Several modifiers may all want to change one player's max health. Instead of each keeping its own total, every modifier owns one named entry in a shared ledger and the engine sums them. Amounts are health points (20 is the vanilla 10 hearts); the engine always starts from a base of 20 and adds every entry:

<pmaxhp.set:Steve,lifesteal,4> writes exactly 4 for that id, replacing the old value. <pmaxhp.modify:Steve,lifesteal,-2> adds -2 to that id's current entry (an unset entry starts at 0). <pmaxhp.get:Steve,lifesteal> reads one id (0 when unset). <pmaxhp.clear:Steve,lifesteal> drops one id, and <pmaxhp.clear:Steve> with no id drops every entry the player has. Writes leave nothing behind; reads yield the entry formatted like other numbers.

Each successful set, modify, or clear immediately applies the new total to the player's max health attribute. Increments also add the gained amount to current health; decreases never touch current health, letting vanilla clamp any overflow. When a player quits or their match tears down, their whole ledger clears automatically.

A total of 0 or less kills permanently: the player dies at once, is eliminated regardless of lives left or role, and their ledger clears without applying the lethal total. These deaths never fire ON_DEATH, so a death script that writes max health cannot recurse into itself. Use <peliminated:player> after a write to check whether the player died this way, and <pstat> reads -1 on every key for eliminated players.

Never edit the max health attribute directly (with attribute commands or another plugin): the next ledger refresh detects the mismatch, warns once per player per match about a Dirty Max HP Hack, and overwrites the foreign value. See Dirty Max HP Hack for details.

Next Steps