Skip to content

Commit f711b4c

Browse files
committed
Fixing wrong json prop name
1 parent e6f86e5 commit f711b4c

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

CustomCommands/Functions.cs

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using CounterStrikeSharp.API;
22
using CounterStrikeSharp.API.Core;
33
using CounterStrikeSharp.API.Modules.Admin;
4+
using CounterStrikeSharp.API.Modules.Entities.Constants;
45
using CustomCommands.Model;
56

67
namespace CustomCommands;
@@ -37,7 +38,7 @@ private void AddCommands(Commands com)
3738
AddCommand(aliases[i], com.Description, (player, info) =>
3839
{
3940
if (player == null) return;
40-
if (!RequiresPermissions(player, com.Permissions))
41+
if (!RequiresPermissions(player, com.Permission))
4142
return;
4243

4344
TriggerMessage(player, com);
@@ -46,23 +47,23 @@ private void AddCommands(Commands com)
4647
}
4748
}
4849

49-
private bool RequiresPermissions(CCSPlayerController player, PermissionsElement permissions)
50+
private bool RequiresPermissions(CCSPlayerController player, Permission permissions)
5051
{
51-
if (permissions.ReguiresAllPermissions)
52+
if (!permissions.ReguiresAllPermissions)
5253
{
5354
foreach (var permission in permissions.PermissionList)
5455
{
5556
if (AdminManager.PlayerHasPermissions(player, new string[]{permission}))
5657
return true;
5758
}
58-
PrintToChat(Receiver.Client, player, "You don't have the required permissions to execute this command1");
59+
PrintToChat(Receiver.Client, player, "You don't have the required permissions to execute this command");
5960
return false;
6061
}
6162
else
6263
{
6364
if (!AdminManager.PlayerHasPermissions(player, permissions.PermissionList.ToArray()))
6465
{
65-
PrintToChat(Receiver.Client, player, "You don't have the required permissions to execute this command2");
66+
PrintToChat(Receiver.Client, player, "You don't have the required permissions to execute this command");
6667
return false;
6768
}
6869
return true;

CustomCommands/Model/CommandsConfig.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ public class Commands
99
public CenterElement CenterMessage { get; set; } = new();
1010
public required Sender PrintTo { get; set; } = Sender.ClientChat;
1111
public List<string> ServerCommands { get; set; } = new();
12-
public PermissionsElement Permissions { get; set; } = new();
12+
public Permission Permission { get; set; } = new();
1313
}
14-
public class PermissionsElement
14+
public class Permission
1515
{
1616
public bool ReguiresAllPermissions { get; set; } = false;
1717
public List<string> PermissionList { get; set; } = new();

0 commit comments

Comments
 (0)