diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-08-19 22:05:12 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-08-19 22:05:12 +0800 |
commit | 1076014e36068a6ee0bb897234c2d886ffa46ef1 (patch) | |
tree | 641e2b509f8b778c1562a4012f6336819cb5c9ab /features/globalSettings/index.js | |
parent | cc0aead21fd1a660a79b1086a38b90771c75d00b (diff) | |
download | SoopyV2-1076014e36068a6ee0bb897234c2d886ffa46ef1.tar.gz SoopyV2-1076014e36068a6ee0bb897234c2d886ffa46ef1.tar.bz2 SoopyV2-1076014e36068a6ee0bb897234c2d886ffa46ef1.zip |
+ /tps command
Diffstat (limited to 'features/globalSettings/index.js')
-rw-r--r-- | features/globalSettings/index.js | 21 |
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 |