import { world, system, GameMode, EntityDamageCause } from "@minecraft/server";
import * as utils from "./cbcl/rm/utils/utils";
import * as settings from "./cbcl/rm/utils/settings";
import * as functions from "./cbcl/rm/utils/functions";
import * as book from "./cbcl/rm/book";
import * as handle_void_death from "./cbcl/rm/utils/handle_void_death";
import { beaconParticle } from "./cbcl/rm/utils/beacon_particle";
import { displayActionbar } from "./cbcl/rm/utils/utils";
import { playerJoins } from "./cbcl/rm/events/player_joins";


let curTick = 0;
const INIT_TIME = 0;


system.runTimeout(() => {
    system.runInterval(() => {
        try {
            if (curTick > INIT_TIME) {
                const allPlayers = world.getPlayers();
                allPlayers.forEach((player) => {
                    if (!player) return;
                    beaconParticle(player);
                    playerJoins(player);
                    displayActionbar(player);
                });
            }
            curTick++;
        } catch (e) {
            console.warn(e);
        }
    }, 0);
}, 20);
