import ObjectRepository from '#repositories/mapObjectRepository' import { BaseEvent } from '#application/base/baseEvent' import { MapObject } from '#entities/mapObject' interface IPayload {} export default class MapObjectListEvent extends BaseEvent { public listen(): void { this.socket.on('gm:mapObject:list', this.handleEvent.bind(this)) } private async handleEvent(data: IPayload, callback: (response: MapObject[]) => void): Promise { if (!(await this.isCharacterGM())) return // get all objects const objects = await ObjectRepository.getAll() return callback(objects) } }