Fix dead players being able to run /home

This commit fixes an issue where players could bypass the respawn timer
by using /home. Specifically, TShock rejects the command if the player
is dead.
This commit is contained in:
Lucas Nicodemus 2021-06-12 22:26:01 -07:00
parent fd97c2268a
commit 4100ecb64e
2 changed files with 6 additions and 1 deletions

View file

@ -19,7 +19,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* Fixed ridiculous typo in `Amethyst Gemtree` text. (@hakusaro)
* Fixed `CTRL + C` / interactive console interrupt not safely shutting down the server. Now, interrupts will cause a safe shutdown (saving the world and disconnecting all players before fully shutting down). Previously, interrupts caused an unsafe shutdown (not saving the world). (@hakusaro)
* Changed "success message" color to `Color.LimeGreen` instead of `Color.Green`. `Color.Green` looks ugly. `Color.LimeGreen` looks less ugly but isn't as offensively bright as pure green. (@hakusaro)
* Fixed `/home` allowing players to bypass the respawn timer. (@hakusaro)
## TShock 4.5.4
* Fixed ridiculous typo in `GetDataHandlers` which caused TShock to read the wrong field in the packet for `usingBiomeTorches`. (@hakusaro, @Arthri)
* Fixed torchgod settings to include whether or not torchgod has been fought by the player before and respect `usingBiomeTorches` setting. (@Quinci135)

View file

@ -2724,6 +2724,11 @@ namespace TShockAPI
private static void Home(CommandArgs args)
{
if (args.Player.Dead)
{
args.Player.SendErrorMessage("You are dead.");
return;
}
args.Player.Spawn(PlayerSpawnContext.RecallFromItem);
args.Player.SendSuccessMessage("Teleported to your spawnpoint.");
}