2020-08-17 17:40:06 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2022-10-26 08:54:54 +08:00
|
|
|
|
using Brigadier.NET;
|
2020-08-17 17:40:06 +08:00
|
|
|
|
|
|
|
|
|
|
namespace MinecraftClient.Commands
|
|
|
|
|
|
{
|
|
|
|
|
|
class Tps : Command
|
|
|
|
|
|
{
|
2020-10-17 19:41:31 +08:00
|
|
|
|
public override string CmdName { get { return "tps"; } }
|
|
|
|
|
|
public override string CmdUsage { get { return "tps"; } }
|
|
|
|
|
|
public override string CmdDesc { get { return "cmd.tps.desc"; } }
|
2020-08-17 17:40:06 +08:00
|
|
|
|
|
2022-10-26 08:54:54 +08:00
|
|
|
|
public override void RegisterCommand(McClient handler, CommandDispatcher<CommandSource> dispatcher)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-10-02 18:31:08 +08:00
|
|
|
|
public override string Run(McClient handler, string command, Dictionary<string, object>? localVars)
|
2020-08-17 17:40:06 +08:00
|
|
|
|
{
|
|
|
|
|
|
var tps = Math.Round(handler.GetServerTPS(), 2);
|
|
|
|
|
|
string color;
|
|
|
|
|
|
if (tps < 10)
|
|
|
|
|
|
color = "§c"; // Red
|
|
|
|
|
|
else if (tps < 15)
|
|
|
|
|
|
color = "§e"; // Yellow
|
2022-10-02 18:31:08 +08:00
|
|
|
|
else
|
|
|
|
|
|
color = "§a"; // Green
|
2020-10-17 19:41:31 +08:00
|
|
|
|
return Translations.Get("cmd.tps.current") + ": " + color + tps;
|
2020-08-17 17:40:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|