fix(sessions): preserve client life and group Tail pages
Release / release (push) Successful in 8m2s
CI / build (push) Successful in 4m49s

This commit is contained in:
dmg committed 2026-09-19 14:04:57 -04:00
1 parent bda7419b8b
commit c85b5e91cc
5 files changed
+167 -13

No files matched your search

@@ -93,9 +93,12 @@ public final class SessionVitals implements AutoCloseable {
finally { releaseMaximum(player, session); }
// On restart there is no hook: native attribute serialization retained ordinary
// base/permanent modifiers, and the native effect lifecycle owns potion expiry/removal.
restoreScale(player, mark.maximum(), ordinary);
player.setFoodLevel(ordinary.food()); player.setSaturation(ordinary.saturation()); player.setExhaustion(ordinary.exhaustion());
// CraftPlayer scale setters send health packets immediately (or queue one for damage
// completion). Restore positive health first: a zero-health packet opens a client death
// screen even when Paper cancels the death and the server-side player survives.
player.setHealth(Math.min(ordinary.health(), Objects.requireNonNull(player.getAttribute(Attribute.MAX_HEALTH)).getValue()));
player.setFoodLevel(ordinary.food()); player.setSaturation(ordinary.saturation()); player.setExhaustion(ordinary.exhaustion());
restoreScale(player, mark.maximum(), ordinary);
write(player, new Mark(session, Phase.RELEASED, mark.maximum(), ordinary));
return true;
}