1
0
forked from noxious/server

Converted more events

This commit is contained in:
2025-01-04 20:11:34 +01:00
parent 47ec425acf
commit 21f4c5328f
21 changed files with 113 additions and 102 deletions

View File

@ -15,9 +15,8 @@ export default class MapObjectRemoveEvent extends BaseEvent {
}
private async handleEvent(data: IPayload, callback: (response: boolean) => void): Promise<void> {
if (!(await this.isCharacterGM())) return
try {
if (!(await this.isCharacterGM())) return
// remove the tile from the disk
const finalFilePath = Storage.getPublicPath('map_objects', data.mapObjectId + '.png')
fs.unlink(finalFilePath, async (err) => {
@ -27,7 +26,8 @@ export default class MapObjectRemoveEvent extends BaseEvent {
return
}
await (await MapObjectRepository.getById(data.mapObjectId))?.delete()
const mapObjectRepository = new MapObjectRepository()
await (await mapObjectRepository.getById(data.mapObjectId))?.delete()
return callback(true)
})