forked from noxious/server
#184: Added commands to toggle rain / fog, command bug fix, minor improvements
This commit is contained in:
@ -24,16 +24,24 @@ export default class AlertCommandEvent {
|
||||
return
|
||||
}
|
||||
|
||||
const args = getArgs('alert', data.message)
|
||||
|
||||
if (!args) {
|
||||
// Check if character exists
|
||||
const character = await CharacterRepository.getByUserAndId(this.socket.user?.id as number, this.socket.characterId as number)
|
||||
if (!character) {
|
||||
gameLogger.error('chat:alert_command error', 'Character not found')
|
||||
callback(false)
|
||||
return
|
||||
}
|
||||
|
||||
const character = await CharacterRepository.getByUserAndId(this.socket.user?.id as number, this.socket.characterId as number)
|
||||
if (!character) {
|
||||
gameLogger.error('chat:alert_command error', 'Character not found')
|
||||
// Check if the user is the GM
|
||||
if (character.role !== 'gm') {
|
||||
gameLogger.info(`User ${character.id} tried to set time but is not a game master.`)
|
||||
callback(false)
|
||||
return
|
||||
}
|
||||
|
||||
const args = getArgs('alert', data.message)
|
||||
|
||||
if (!args) {
|
||||
callback(false)
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user