forked from RainOrigami/BattleBitBaseModules
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPermissionsCommands.cs
More file actions
35 lines (30 loc) · 1.27 KB
/
Copy pathPermissionsCommands.cs
File metadata and controls
35 lines (30 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using BattleBitAPI.Common;
using BBRAPIModules;
using Commands;
using Permissions;
namespace PermissionsManager;
[RequireModule(typeof(PlayerPermissions))]
[RequireModule(typeof(CommandHandler))]
public class PermissionsCommands : BattleBitModule
{
[ModuleReference]
public PlayerPermissions PlayerPermissions { get; set; }
[ModuleReference]
public CommandHandler CommandHandler { get; set; }
public override void OnModulesLoaded()
{
this.CommandHandler.Register(this);
}
[CommandCallback("addperm", Description = "Adds a permission to a player", AllowedRoles = Roles.Admin)]
public void AddPermissionCommand(RunnerPlayer commandSource, RunnerPlayer player, Roles permission)
{
this.PlayerPermissions.AddPlayerRoles(player.SteamID, permission);
commandSource.Message($"Added permission {permission} to {player.Name}");
}
[CommandCallback("removeperm", Description = "Removes a permission from a player", AllowedRoles = Roles.Admin)]
public void RemovePermissionCommand(RunnerPlayer commandSource, RunnerPlayer player, Roles permission)
{
this.PlayerPermissions.RemovePlayerRoles(player.SteamID, permission);
commandSource.Message($"Removed permission {permission} from {player.Name}");
}
}