zio fork 1.8.2b-zio9: admin menu honours command overrides, @zio/penalties
Every player and server entry in the admin menu names its command, and an overridden entry is
checked with the override's check_type ("any" passes with one flag), the way CSS checks the typed
command; upstream required every flag. css_penalties for someone else needs @zio/penalties or
@css/root instead of @css/kick.
This commit is contained in:
parent
65a413fa52
commit
cf1090cbd2
6 changed files with 38 additions and 15 deletions
|
|
@ -144,6 +144,20 @@ internal static class Helper
|
|||
return string.Join(" ", parts);
|
||||
}
|
||||
|
||||
// zio: whether an admin_overrides.json override lets the player run the command, checked the way
|
||||
// CSS checks a typed command: "all" needs every flag, anything else ("any") needs one of them.
|
||||
internal static bool CanRunOverriddenCommand(CCSPlayerController player, string commandName)
|
||||
{
|
||||
var data = AdminManager.GetCommandOverrideData(commandName);
|
||||
if (data == null) return false;
|
||||
var flags = data.Flags.ToArray();
|
||||
BaseRequiresPermissions check = data.CheckType == "all"
|
||||
? new RequiresPermissions(flags)
|
||||
: new RequiresPermissionsOr(flags);
|
||||
check.Command = commandName;
|
||||
return check.CanExecuteCommand(player);
|
||||
}
|
||||
|
||||
// zio: rank groups, highest first, and their chat abbreviations. Guardian (VIP) is last, so a
|
||||
// staff rank wins.
|
||||
private static readonly (string Group, string Tag)[] StaffRanks =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue