Skip to content

Commit 45e3964

Browse files
SetGroup Method!
New method allowing you to set or remove user group for specified players!
1 parent 3b1bc63 commit 45e3964

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
pls.ForEach(p=>p.UserGroup = ServerStatic.PermissionsHandler.GetGroup(gr == "NONE" ? null: gr));
23+
}
24+
}

SER.csproj

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

0 commit comments

Comments
 (0)