diff --git a/MethodSystem/Methods/PlayerMethods/SetGroupMethod.cs b/MethodSystem/Methods/PlayerMethods/SetGroupMethod.cs new file mode 100644 index 0000000..2afb91d --- /dev/null +++ b/MethodSystem/Methods/PlayerMethods/SetGroupMethod.cs @@ -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 pls = Args.GetPlayers("players"); + foreach(Player p in pls) + { + p.UserGroup = gr == "NONE" ? null : ServerStatic.PermissionsHandler.GetGroup(gr); + } + } +} \ No newline at end of file diff --git a/SER.csproj b/SER.csproj index 609eef1..feff6ec 100644 --- a/SER.csproj +++ b/SER.csproj @@ -208,6 +208,7 @@ +