From 1076014e36068a6ee0bb897234c2d886ffa46ef1 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Fri, 19 Aug 2022 22:05:12 +0800 Subject: + /tps command --- features/globalSettings/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index e5dd47b..aaa425d 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -209,6 +209,27 @@ class GlobalSettings extends Feature { this.registerCommand("lobbyday", () => { ChatLib.chat(this.FeatureManager.messagePrefix + "Current lobby is day " + (World.getTime() / 20 / 60 / 20).toFixed(2)) }) + this.registerCommand("tps", (time = "3") => { + time = parseInt(time) + ChatLib.chat(this.FeatureManager.messagePrefix + "Loading tps... this will take " + time + "s") + + let packetMoves = 0 + let ticks = 0 + let packetReceived = register("packetReceived", () => { + packetMoves++ + }) + + let tick = register("tick", () => { + if (packetMoves > 0) ticks++ + packetMoves = 0 + }) + + delay(3000, () => { + packetReceived.unregister() + tick.unregister() + ChatLib.chat(this.FeatureManager.messagePrefix + "Tps: " + (ticks / time).toFixed(1)) + }) + }) this.lastCookies = 0 -- cgit