1
0
forked from noxious/server

More improvements

This commit is contained in:
2025-01-04 19:05:54 +01:00
parent 067976c54a
commit 9a448542d3
11 changed files with 38 additions and 184 deletions

View File

@ -14,22 +14,11 @@ export default class SetTimeCommand extends BaseEvent {
private async handleEvent(data: TypePayload, callback: (response: boolean) => void): Promise<void> {
try {
if (!ChatService.isCommand(data.message, 'time')) {
return
}
// Check if command is time
if (!ChatService.isCommand(data.message, 'time')) return
// Check if character exists
const character = await CharacterRepository.getByUserAndId(this.socket.userId!, this.socket.characterId!)
if (!character) {
this.logger.error('chat:alert_command error', 'Character not found')
return
}
// Check if the user is the GM
if (character.role !== 'gm') {
this.logger.info(`User ${character.id} tried to set time but is not a game master.`)
return
}
// Check if character exists and is GM
if (!(await this.isCharacterGM())) return
// Get arguments
const args = ChatService.getArgs('time', data.message)