"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
const AnnouncePacket_1 = require("./AnnouncePacket");
class MupenServerPlugin {
    ModLoader;
    pluginName;
    pluginHash;
    preinit() {
    }
    init() {
        if (this.ModLoader.isServer) {
            setInterval(() => {
                try {
                    if (fs_1.default.existsSync("./announce.json")) {
                        let data = JSON.parse(fs_1.default.readFileSync("./announce.json").toString());
                        fs_1.default.unlinkSync("./announce.json");
                        this.ModLoader.serverSide.sendPacket(new AnnouncePacket_1.AnnouncePacket(data.text));
                    }
                }
                catch (err) {
                    this.ModLoader.logger.error(err);
                }
            }, 30 * 1000);
        }
    }
    postinit() {
    }
    onTick(frame) {
    }
}
module.exports = MupenServerPlugin;
//# sourceMappingURL=MupenServerPlugin.js.map