Skip to content

Commit a35b647

Browse files
Merge pull request #3 from PulchnyAlboert/main
I see no issues with the PR. Welcome on board!
2 parents 36911e5 + cb16d4d commit a35b647

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System.Collections.Generic;
2+
using SER.ArgumentSystem.Arguments;
3+
using SER.ArgumentSystem.BaseArguments;
4+
using SER.MethodSystem.BaseMethods;
5+
using LabApi.Features.Wrappers;
6+
7+
namespace SER.MethodSystem.Methods.PlayerMethods;
8+
9+
public class SetGroupMethod : SynchronousMethod
10+
{
11+
public override string Description => "Sets or removes group from specified players";
12+
13+
public override Argument[] ExpectedArguments => [
14+
new PlayersArgument("players"),
15+
new TextArgument("group"){Description = "Name of the group or set to NONE if you want to remove group from specified players" }
16+
];
17+
18+
public override void Execute()
19+
{
20+
string gr = Args.GetText("group");
21+
List<Player> pls = Args.GetPlayers("players");
22+
foreach(Player p in pls)
23+
{
24+
p.UserGroup = gr == "NONE" ? null : ServerStatic.PermissionsHandler.GetGroup(gr);
25+
}
26+
}
27+
}

SER.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@
209209
<Compile Include="MethodSystem\Methods\PlayerMethods\SetCustomInfoMethod.cs" />
210210
<Compile Include="MethodSystem\Methods\PlayerMethods\GodModeMethod.cs" />
211211
<Compile Include="MethodSystem\Methods\PlayerMethods\NoclipMethod.cs" />
212+
<Compile Include="MethodSystem\Methods\PlayerMethods\SetGroupMethod.cs" />
212213
<Compile Include="MethodSystem\Methods\PlayerMethods\SetSizeMethod.cs" />
213214
<Compile Include="MethodSystem\Methods\PlayerVariableMethods\ContainsPlayerMethod.cs" />
214215
<Compile Include="MethodSystem\Methods\PlayerVariableMethods\GetPlayerFromReferenceMethod.cs" />

0 commit comments

Comments
 (0)