From 4100ecb64ed70697b5204c361f90d046e3a215bb Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 12 Jun 2021 22:26:01 -0700 Subject: [PATCH] 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. --- CHANGELOG.md | 2 +- TShockAPI/Commands.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6efd6085..c3aac867 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 6168e629..2a83350f 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -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."); }