mirror of
https://github.com/neoStudiosLCE/neoLegacy.git
synced 2026-08-20 09:57:09 +00:00
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:
parent
52271f05fe
commit
ae006e03f4
|
|
@ -568,6 +568,11 @@ void ServerPlayer::die(DamageSource *source)
|
||||||
if (level->getLevelData()->isHardcore())
|
if (level->getLevelData()->isHardcore())
|
||||||
{
|
{
|
||||||
setGameMode(GameType::ADVENTURE);
|
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))
|
if (!level->getGameRules()->getBoolean(GameRules::RULE_KEEPINVENTORY))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue