Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions MethodSystem/Methods/PlayerMethods/SetGroupMethod.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Collections.Generic;
using SER.ArgumentSystem.Arguments;
using SER.ArgumentSystem.BaseArguments;
using SER.MethodSystem.BaseMethods;
using LabApi.Features.Wrappers;

namespace SER.MethodSystem.Methods.PlayerMethods;

public class SetGroupMethod : SynchronousMethod
{
public override string Description => "Sets or removes group from specified players";

public override Argument[] ExpectedArguments => [
new PlayersArgument("players"),
new TextArgument("group"){Description = "Name of the group or set to NONE if you want to remove group from specified players" }
];

public override void Execute()
{
string gr = Args.GetText("group");
List<Player> pls = Args.GetPlayers("players");
foreach(Player p in pls)
{
p.UserGroup = gr == "NONE" ? null : ServerStatic.PermissionsHandler.GetGroup(gr);
}
}
}
1 change: 1 addition & 0 deletions SER.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@
<Compile Include="MethodSystem\Methods\PlayerMethods\SetCustomInfoMethod.cs" />
<Compile Include="MethodSystem\Methods\PlayerMethods\GodModeMethod.cs" />
<Compile Include="MethodSystem\Methods\PlayerMethods\NoclipMethod.cs" />
<Compile Include="MethodSystem\Methods\PlayerMethods\SetGroupMethod.cs" />
<Compile Include="MethodSystem\Methods\PlayerMethods\SetSizeMethod.cs" />
<Compile Include="MethodSystem\Methods\PlayerVariableMethods\ContainsPlayerMethod.cs" />
<Compile Include="MethodSystem\Methods\PlayerVariableMethods\GetPlayerFromReferenceMethod.cs" />
Expand Down