mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 04:21:41 +09:00
Minor bug fixes
This commit is contained in:
25
config/expcore-commands/auth_runtime_disable.lua
Normal file
25
config/expcore-commands/auth_runtime_disable.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
--- This config for command auth allows commands to be globally enabled and disabled during runtime
|
||||
-- this config adds Commands.disable and Commands.enable to enable and disable commands for all users
|
||||
local Commands = require 'expcore.commands'
|
||||
local Global = require 'utils.global'
|
||||
|
||||
local disabled_commands = {}
|
||||
Global.register(disabled_commands,function(tbl)
|
||||
disabled_commands = tbl
|
||||
end)
|
||||
|
||||
function Commands.disable(command_name)
|
||||
disabled_commands[command_name] = true
|
||||
end
|
||||
|
||||
function Commands.enable(command_name)
|
||||
disabled_commands[command_name] = nil
|
||||
end
|
||||
|
||||
Commands.add_authenticator(function(player,command,tags,reject)
|
||||
if disabled_commands[command] then
|
||||
return reject{'command-auth.command-disabled'}
|
||||
else
|
||||
return true
|
||||
end
|
||||
end)
|
||||
Reference in New Issue
Block a user