Prevent exit-without-saving loophole for hardcore players

Switch player to Adventure mode on death in hardcore mode, ban their XUID, and trigger a save action to prevent quitting without saving.
This commit is contained in:
Revela
2026-03-15 00:37:14 -05:00
parent 52271f05fe
commit ae006e03f4

View File

@@ -568,6 +568,11 @@ void ServerPlayer::die(DamageSource *source)
if (level->getLevelData()->isHardcore())
{
setGameMode(GameType::ADVENTURE);
// Ban this player's XUID and force-save so the host
// cannot circumvent the death by quitting without saving.
server->getPlayers()->banXuid(getOnlineXuid());
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), eXuiServerAction_SaveGame);
}
if (!level->getGameRules()->getBoolean(GameRules::RULE_KEEPINVENTORY))