diff --git a/EXILED/Exiled.API/Features/Server.cs b/EXILED/Exiled.API/Features/Server.cs index 96b8311fdf..825cfb3566 100644 --- a/EXILED/Exiled.API/Features/Server.cs +++ b/EXILED/Exiled.API/Features/Server.cs @@ -111,7 +111,27 @@ public static string Name /// /// Gets the actual ticks per second of the server. /// - public static double Tps => Math.Round(1f / Time.smoothDeltaTime); + public static double Tps + { + get + { + double delta = Time.deltaTime; + + if (delta <= 0) + return MaxTps; + + double tps = 1d / delta; + + tps = Math.Min(tps, MaxTps); + + return tps; + } + } + + /// + /// Gets the average ticks per second of the server. + /// + public static double SmoothTps => Math.Round(1f / Time.smoothDeltaTime); /// /// Gets or sets the max ticks per second of the server. diff --git a/EXILED/Exiled.Events/Commands/TpsCommand.cs b/EXILED/Exiled.Events/Commands/TpsCommand.cs index 722de3b61e..bca8efdf6b 100644 --- a/EXILED/Exiled.Events/Commands/TpsCommand.cs +++ b/EXILED/Exiled.Events/Commands/TpsCommand.cs @@ -31,7 +31,7 @@ public class TpsCommand : ICommand /// public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) { - double diff = Server.Tps / Server.MaxTps; + double diff = Server.SmoothTps / Server.MaxTps; string color = diff switch { > 0.9 => "green", @@ -39,7 +39,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s _ => "red" }; - response = $"{Server.Tps}/{Server.MaxTps}"; + response = $"{Server.SmoothTps}/{Server.MaxTps}"; return true; } }