Skip to content

Commit 12ce440

Browse files
Create GetPlayersWithUCRRoleMethod.cs
1 parent e8ddef0 commit 12ce440

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using JetBrains.Annotations;
2+
using LabApi.Features.Wrappers;
3+
using SER.Code.ArgumentSystem.Arguments;
4+
using SER.Code.ArgumentSystem.BaseArguments;
5+
using SER.Code.Extensions;
6+
using SER.Code.MethodSystem.BaseMethods.Synchronous;
7+
using SER.Code.MethodSystem.Structures;
8+
using SER.Code.ValueSystem;
9+
using UncomplicatedCustomRoles.API.Features;
10+
11+
namespace SER.Code.MethodSystem.Methods.UCRMethods;
12+
13+
// ReSharper disable once InconsistentNaming
14+
[UsedImplicitly]
15+
public class GetPlayersWithUCRRoleMethod : ReturningMethod<PlayerValue>, IDependOnFramework
16+
{
17+
public IDependOnFramework.Type DependsOn => IDependOnFramework.Type.Ucr;
18+
19+
public override string Description => "Gets all players who have a provided UCR role.";
20+
21+
public override Argument[] ExpectedArguments { get; } =
22+
[
23+
new IntArgument("role id")
24+
];
25+
26+
public override void Execute()
27+
{
28+
var id = Args.GetInt("role id");
29+
ReturnValue = Player.ReadyList
30+
.Where(p => SummonedCustomRole.Get(p)?.Role.Id == id)
31+
.ToPlayerValue();
32+
}
33+
}

0 commit comments

Comments
 (0)