import { GlobalPlugin } from '../plugins/GlobalPlugin.js'; import { Connection } from './Connection.js'; import { PluginManager } from './PluginManager.js'; import { Room } from './Room.js'; import { Session } from './Session.js'; export type StoredSkyChat = { guestId: number; messageId: number; roomId: number; rooms: number[]; }; /** * The room manager */ export declare class RoomManager { static readonly STORAGE_MAIN_FILE: string; private static TICK_INTERVAL; private static FULL_SYNC_INTERVAL; private static CURRENT_GUEST_ID; readonly pluginManager: PluginManager; rooms: Room[]; constructor(pluginManager: PluginManager); start(): void; /** * Try to load the room manager data from disk */ private load; /** * Save the room manager data to disk */ private save; /** * Clean-up function, executed once in a while */ private tick; /** * Returns whether a room id exists */ hasRoomId(id: number): boolean; /** * Get a room by id */ getRoomById(id: number): Room | null; findSuitableRoom(connection: Connection): Room | undefined; /** * Create a new room */ createRoom(name?: string): Room; /** * Try to find a private room with the exact give participant usernames */ findPrivateRoom(usernames: string[]): Room | null; /** * Create a new private room */ createPrivateRoom(usernames: string[]): Room; /** * Delete a room */ deleteRoom(id: number): Promise; /** * Reorder public rooms */ reOrderRooms(order: number[]): Promise; /** * Convenience method for plugins to use */ getPlugin(commandName: string): GlobalPlugin; /** * Send the list of rooms for a specific connection * @param connection */ sendRoomList(connectionOrSession: Connection | Session): void; /** * Called each time a new connection is created */ onConnectionCreated(connection: Connection): Promise; }