import { CancelableEvent } from "@skeldjs/events"; import { Connection, Room } from "../../../worker"; /** * Emitted before a player successfully or unsuccessfully joins a room on the * server. * * This event allows you to redirect the player to another game, or to completely * prevent them from joining. * * A better event to use for when a player has successfully joined a room is * the [`player.join`](https://skeld.js.org/classes/core.playerjoinevent.html) * event. * * @example * ```ts * .@EventListener("worker.beforejoin") * onWorkerBeforeJoin(ev: WorkerBeforeJoinEvent) { * for (const [ netId, mod ] of ev.client.mods) { * if (mod.modid === "com.andruzzzhka.customserversclient") { * ev.cancel(); * return ev.client.disconnect("Do not join with custom servers client!!!"); * } * } * } * ``` */ export declare class WorkerBeforeJoinEvent extends CancelableEvent { /** * The client that is attempting to join the room. */ readonly client: Connection; /** * The game code that the player used to search for a room. */ readonly gameCode: number; /** * The room that was found, or `undefined` if there is no room on the * server with the code. */ readonly foundRoom: Room | undefined; static eventName: "worker.beforejoin"; eventName: "worker.beforejoin"; private _alteredRoom; constructor( /** * The client that is attempting to join the room. */ client: Connection, /** * The game code that the player used to search for a room. */ gameCode: number, /** * The room that was found, or `undefined` if there is no room on the * server with the code. */ foundRoom: Room | undefined); /** * The room that the player will join instead, if changed. */ get alteredRoom(): Room | undefined; /** * Change the room that the player will join. * @param room The room that the player will join instead, set to `undefined` * to give the player a "Game Not Found" error. */ setRoom(room: Room | undefined): void; }