diff --git a/src/main/java/cc/fros/features/modules/hud/TpsHudModule.java b/src/main/java/cc/fros/features/modules/hud/TpsHudModule.java new file mode 100644 index 0000000..48bc7e4 --- /dev/null +++ b/src/main/java/cc/fros/features/modules/hud/TpsHudModule.java @@ -0,0 +1,27 @@ +package cc.fros.features.modules.hud; + +import cc.fros.Fros; +import cc.fros.event.impl.render.Render2DEvent; +import cc.fros.features.modules.client.HudModule; +import cc.fros.util.render.FrosFont; + +import java.util.Locale; + +public class TpsHudModule extends HudModule { + + public TpsHudModule() { + super("TPS", "Display the server's tps", 100, 10); + } + + @Override + protected void render(Render2DEvent e) { + super.render(e); + + String tpsStr = String.format(Locale.ROOT, "TPS: %.1f", Fros.serverManager.getTps()); + + FrosFont.draw(e.getContext(), tpsStr, (int) getX(), (int) getY(), -1); + + setWidth(FrosFont.width(tpsStr)); + setHeight(FrosFont.lineHeight()); + } +} diff --git a/src/main/java/cc/fros/manager/ModuleManager.java b/src/main/java/cc/fros/manager/ModuleManager.java index 8283381..dfe6277 100644 --- a/src/main/java/cc/fros/manager/ModuleManager.java +++ b/src/main/java/cc/fros/manager/ModuleManager.java @@ -19,6 +19,7 @@ import cc.fros.features.modules.combat.CriticalsModule; import cc.fros.features.modules.combat.KeyPearlModule; import cc.fros.features.modules.hud.ArrayListHudModule; import cc.fros.features.modules.hud.ArmorHudModule; +import cc.fros.features.modules.hud.TpsHudModule; import cc.fros.features.modules.hud.CoordinatesHudModule; import cc.fros.features.modules.hud.FpsHudModule; import cc.fros.features.modules.hud.PingHudModule; @@ -59,6 +60,7 @@ public class ModuleManager implements Jsonable, Util { register(new WelcomerHudModule()); register(new TimeHudModule()); register(new ArmorHudModule()); + register(new TpsHudModule()); register(new HudEditorModule()); register(new ClickGuiModule()); register(new NotificationsModule());