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

@ -14,15 +14,11 @@ export abstract class BaseEntity {
return this.execute('persist', 'save entity')
}
async update(): Promise<this> {
return this.execute('merge', 'update entity')
}
async delete(): Promise<this> {
return this.execute('remove', 'remove entity')
}
private async execute(method: 'persist' | 'merge' | 'remove', actionDescription: string): Promise<this> {
private async execute(method: 'persist' | 'remove', actionDescription: string): Promise<this> {
try {
const em = this.getEntityManager()

View File

@ -14,7 +14,8 @@ export abstract class BaseEvent {
) {}
protected async getCharacter(): Promise<Character | null> {
return CharacterRepository.getById(this.socket.characterId!)
const characterRepository = new CharacterRepository()
return characterRepository.getById(this.socket.characterId!)
}
protected async isCharacterGM(): Promise<boolean> {