add option to disable req command globally

This commit is contained in:
nikky 2018-06-25 14:25:57 +02:00
parent 33c94a589c
commit 602762f371
2 changed files with 9 additions and 2 deletions

View File

@ -58,7 +58,8 @@ object BridgeCommandRegistry {
commandMap.clear() commandMap.clear()
val permStatus = PermissionConfig.loadPermFile() val permStatus = PermissionConfig.loadPermFile()
register("help", HelpCommand) register("help", HelpCommand)
register("req", PermCommand) if(cfg.command.permissionRequests)
register("req", PermCommand)
val cmdStatus = CommandConfig.readConfig() val cmdStatus = CommandConfig.readConfig()
CommandConfig.commands.forEach { (alias, command) -> CommandConfig.commands.forEach { (alias, command) ->
register(alias, command) register(alias, command)

View File

@ -35,7 +35,8 @@ data class BaseConfig(val rootDir: File) {
data class CommandOptions( data class CommandOptions(
val prefix: Char = '!', val prefix: Char = '!',
val enable: Boolean = true val enable: Boolean = true,
val permissionRequests: Boolean = true
) )
data class ConnectOptions( data class ConnectOptions(
@ -172,6 +173,11 @@ data class BaseConfig(val rootDir: File) {
"prefix", "prefix",
prefix, prefix,
"Prefix for MC bridge commands. Accepts a single character (not alphanumeric or /)" "Prefix for MC bridge commands. Accepts a single character (not alphanumeric or /)"
),
permissionRequests = it.getOrDefault(
"permissionRequests",
permissionRequests,
"Enable the 'req' command for requestion permissions from chat"
) )
) )
} }