diff --git a/tournaments/index.js b/tournaments/index.js index e082bd47b0..16c19f40fd 100644 --- a/tournaments/index.js +++ b/tournaments/index.js @@ -820,9 +820,7 @@ CommandParser.commands.tournament = function (paramString, room, user) { "More detailed help can be found here" ); } else if (cmd === 'on' || cmd === 'enable') { - if (!user.can('tournamentsmanagement')) { - return this.sendReply(cmd + " - Access denied."); - } + if (!this.can('tournamentsmanagement', null, room)) return; if (room.toursEnabled) { return this.sendReply("Tournaments are already enabled."); } @@ -833,9 +831,7 @@ CommandParser.commands.tournament = function (paramString, room, user) { } return this.sendReply("Tournaments enabled."); } else if (cmd === 'off' || cmd === 'disable') { - if (!user.can('tournamentsmanagement')) { - return this.sendReply(cmd + " - Access denied."); - } + if (!this.can('tournamentsmanagement', null, room)) return; if (!room.toursEnabled) { return this.sendReply("Tournaments are already disabled."); } @@ -847,11 +843,9 @@ CommandParser.commands.tournament = function (paramString, room, user) { return this.sendReply("Tournaments disabled."); } else if (cmd === 'create' || cmd === 'new') { if (room.toursEnabled) { - if (!user.can('tournaments', null, room)) { - return this.sendReply(cmd + " - Access denied."); - } + if (!this.can('tournaments', null, room)) return; } else { - if (!user.can('tournamentsmanagement'), null, room) { + if (!user.can('tournamentsmanagement', null, room)) { return this.sendReply("Tournaments are disabled in this room ("+room.id+")."); } }