mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 03:25:23 +09:00
Migrate all commands to new lib
This commit is contained in:
23
exp_scenario/module/commands/_authorities.lua
Normal file
23
exp_scenario/module/commands/_authorities.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
--[[-- Command Authorities - Roles
|
||||
Adds a permission authority for exp roles
|
||||
]]
|
||||
|
||||
local Commands = require("modules/exp_commands")
|
||||
local add, allow, deny = Commands.add_permission_authority, Commands.status.success, Commands.status.unauthorised
|
||||
|
||||
local Roles = require("modules/exp_legacy/expcore/roles")
|
||||
local player_allowed = Roles.player_allowed
|
||||
|
||||
local authorities = {}
|
||||
|
||||
--- If a command has the flag "character_only" then the command can only be used outside of remote view
|
||||
authorities.exp_permission =
|
||||
add(function(player, command)
|
||||
if not player_allowed(player, command.flags.exp_permission or ("command/" .. command)) then
|
||||
return deny{ "exp-commands-authorities_role.deny" }
|
||||
else
|
||||
return allow()
|
||||
end
|
||||
end)
|
||||
|
||||
return authorities
|
||||
Reference in New Issue
Block a user