mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-14 00:58:18 -05:00
support for loading minimum permission level from config for script commands
This commit is contained in:
@ -112,15 +112,25 @@ namespace SharedLibraryCore
|
||||
get => permission;
|
||||
protected set
|
||||
{
|
||||
try
|
||||
{
|
||||
permission = _config?.Commands[GetType().Name].MinimumPermission ?? value;
|
||||
}
|
||||
|
||||
catch (KeyNotFoundException)
|
||||
if (_config is null)
|
||||
{
|
||||
permission = value;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_config.Commands.TryGetValue(GetType().Name, out var byClassName))
|
||||
{
|
||||
permission = byClassName.MinimumPermission;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_config.Commands.TryGetValue(this.CommandConfigNameForType(), out var byCommandName))
|
||||
{
|
||||
permission = byCommandName.MinimumPermission;
|
||||
return;
|
||||
}
|
||||
|
||||
permission = value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,4 +159,4 @@ namespace SharedLibraryCore
|
||||
|
||||
public bool IsBroadcast { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user