import { system, world } from "@minecraft/server";
export class TickPerSecond {
    ticks = 0;
    tps = 0;
    last = 0;
    constructor() {
        system.runInterval(() => {
            this.ticks++;
            if (Date.now() - this.last > 1000) {
                this.tps = this.ticks;
                this.ticks = 0;
                this.last = Date.now();
            }
            world.getAllPlayers().forEach(player => {
                if (player.hasTag("allanz:show_tps")) {
                    player.onScreenDisplay.setActionBar("TPS: " + this.tps);
                }
            });
        }, 1);
    }
    viewTPS() {
    }
}
