1
0
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:
RaidMax
2024-07-14 11:21:47 -05:00
parent a34ac7d224
commit 95523885b8
3 changed files with 35 additions and 22 deletions

View File

@ -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; }
}
}
}