diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index 5d30da0e..fb920732 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -441,12 +441,12 @@ namespace TShockAPI [Description("Whether or not to log REST API connections.")] public bool LogRest = false; - /// The number of seconds a player must wait before being respawned. - [Description("The number of seconds a player must wait before being respawned.")] + /// The number of seconds a player must wait before being respawned. Cannot be longer than normal value now. Use at your own risk. + [Description("The number of seconds a player must wait before being respawned. Cannot be longer than normal value now. Use at your own risk.")] public int RespawnSeconds = 5; - /// The number of seconds a player must wait before being respawned if there is a boss nearby. - [Description("The number of seconds a player must wait before being respawned if there is a boss nearby.")] + /// The number of seconds a player must wait before being respawned if there is a boss nearby. Cannot be longer than normal value now. Use at your own risk. + [Description("The number of seconds a player must wait before being respawned if there is a boss nearby. Cannot be longer than normal value now. Use at your own risk.")] public int RespawnBossSeconds = 10; /// Disables a player if this number of tiles is painted within 1 second. diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 93d79dea..ade308cd 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2065,6 +2065,11 @@ namespace TShockAPI private static bool HandleSpawn(GetDataHandlerArgs args) { + if (args.Player.Dead && args.Player.RespawnTimer > 0) + { + return true; + } + byte player = args.Data.ReadInt8(); short spawnx = args.Data.ReadInt16(); short spawny = args.Data.ReadInt16(); diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 8f450604..49373448 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -299,9 +299,10 @@ namespace TShockAPI /// public int RespawnTimer { - get => TPlayer.respawnTimer; - set => TPlayer.respawnTimer = value; + get => _respawnTimer; + set => TPlayer.respawnTimer = (_respawnTimer = value) * 60; } + private int _respawnTimer; /// /// Whether the player is dead or not. @@ -1196,7 +1197,7 @@ namespace TShockAPI PlayerIndex = (byte)Index, TileX = (short)tilex, TileY = (short)tiley, - RespawnTimer = respawnTimer ?? TShock.Players[Index].TPlayer.respawnTimer, + RespawnTimer = respawnTimer ?? TShock.Players[Index].RespawnTimer * 60, PlayerSpawnContext = context, }; msg.PackFull(ms);