aboutsummaryrefslogtreecommitdiff
path: root/features/globalSettings/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'features/globalSettings/index.js')
-rw-r--r--features/globalSettings/index.js21
1 files changed, 21 insertions, 0 deletions
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