Skip to content

Commit 7b313d0

Browse files
authored
Merge pull request #4 from UncomplicatedCustomServer/proposal
updoot with perrmissions
2 parents 948f914 + d853982 commit 7b313d0

5 files changed

Lines changed: 35 additions & 0 deletions

File tree

UncomplicatedCustomItems/Commands/Admin/List.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using CommandSystem;
22
using Exiled.API.Features;
3+
using Exiled.Permissions.Extensions;
34
using System;
45
using UncomplicatedCustomItems.API;
56
using UncomplicatedCustomItems.Interfaces;
@@ -17,6 +18,12 @@ public class List : PlayerCommandBase
1718

1819
public override bool Execute(ArraySegment<string> arguments, Player player, out string response)
1920
{
21+
if (!player.CheckPermission("uci.list"))
22+
{
23+
response = "Sorry but you don't have the permission to use that command!";
24+
return false;
25+
}
26+
2027
response = "List of every registered custom Items:\n\n Id | Type | Name";
2128

2229
foreach (ICustomItem Item in Manager.Items.Values)

UncomplicatedCustomItems/Commands/Admin/Summon.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using CommandSystem;
22
using Exiled.API.Features;
3+
using Exiled.Permissions.Extensions;
34
using System;
45
using UncomplicatedCustomItems.API;
56
using UncomplicatedCustomItems.API.Features;
@@ -17,6 +18,12 @@ public class Summon : PlayerCommandBase
1718

1819
public override bool Execute(ArraySegment<string> arguments, Player player, out string response)
1920
{
21+
if (!player.CheckPermission("uci.summon"))
22+
{
23+
response = "Sorry but you don't have the permission to use that command!";
24+
return false;
25+
}
26+
2027
if (arguments.Count < 1)
2128
{
2229
response = $"No argument(s) found!\nSyntax: .ucr summon <CustomItem Id> (Player Id)";

UncomplicatedCustomItems/Commands/Admin/Summoned.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using CommandSystem;
22
using Exiled.API.Features;
3+
using Exiled.Permissions.Extensions;
34
using System;
45
using UncomplicatedCustomItems.API;
56
using UncomplicatedCustomItems.API.Features;
@@ -18,6 +19,12 @@ public class Summoned : PlayerCommandBase
1819

1920
public override bool Execute(ArraySegment<string> arguments, Player player, out string response)
2021
{
22+
if (!player.CheckPermission("uci.summoned"))
23+
{
24+
response = "Sorry but you don't have the permission to use that command!";
25+
return false;
26+
}
27+
2128
response = "List of every registered custom Items:\n\n Serial | Id | Status | Name | Owner";
2229

2330
foreach (SummonedCustomItem Item in Manager.SummonedItems)

UncomplicatedCustomItems/Commands/User/Read.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Exiled.API.Features;
2+
using Exiled.Permissions.Extensions;
23
using System;
34
using UncomplicatedCustomItems.API;
45
using UncomplicatedCustomItems.API.Features;
@@ -15,6 +16,12 @@ public class Read : PlayerCommandBase
1516

1617
public override bool Execute(ArraySegment<string> arguments, Player player, out string response)
1718
{
19+
if (!player.CheckPermission("uci.read"))
20+
{
21+
response = "Sorry but you don't have the permission to use that command!";
22+
return false;
23+
}
24+
1825
if (player.CurrentItem is null || !Utilities.TryGetSummonedCustomItem(player.CurrentItem.Serial, out SummonedCustomItem Item))
1926
{
2027
response = "You must hold the custom item!";

UncomplicatedCustomItems/Commands/User/Use.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Exiled.API.Features;
2+
using Exiled.Permissions.Extensions;
23
using System;
34
using UncomplicatedCustomItems.API;
45
using UncomplicatedCustomItems.API.Features;
@@ -15,6 +16,12 @@ public class Use : PlayerCommandBase
1516

1617
public override bool Execute(ArraySegment<string> arguments, Player player, out string response)
1718
{
19+
if (!player.CheckPermission("uci.use"))
20+
{
21+
response = "Sorry but you don't have the permission to use that command!";
22+
return false;
23+
}
24+
1825
if (player.CurrentItem is null || !Utilities.TryGetSummonedCustomItem(player.CurrentItem.Serial, out SummonedCustomItem Item) || Item.CustomItem.CustomItemType != CustomItemType.Item)
1926
{
2027
response = "You must hold the custom item!";

0 commit comments

Comments
 (0)