-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathClearEffectMethod.cs
More file actions
39 lines (33 loc) · 1.28 KB
/
ClearEffectMethod.cs
File metadata and controls
39 lines (33 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using Exiled.API.Enums;
using Exiled.API.Features;
using JetBrains.Annotations;
using SER.Code.ArgumentSystem.Arguments;
using SER.Code.ArgumentSystem.BaseArguments;
using SER.Code.Helpers;
using SER.Code.MethodSystem.BaseMethods.Synchronous;
using SER.Code.MethodSystem.MethodDescriptors;
using SER.Code.MethodSystem.Structures;
namespace SER.Code.MethodSystem.Methods.EffectMethods;
[UsedImplicitly]
public class ClearEffectMethod : SynchronousMethod, IDependOnFramework
{
public override string Description => "Removes the provided status effect from players.";
public override Argument[] ExpectedArguments =>
[
new PlayersArgument("players"),
new EnumArgument<EffectType>("effect type")
{ DefaultValue = new (null, "Removes all status effects") },
];
public override void Execute()
{
var players = Args.GetPlayers("players");
var effectType = Args.GetNullableEnum<EffectType>("effect type");
if (effectType.HasValue)
foreach (var plr in players)
Player.Get(plr).DisableEffect(effectType.Value);
else
foreach (var plr in players)
Player.Get(plr).DisableAllEffects();
}
public FrameworkBridge.Type DependsOn => FrameworkBridge.Type.Exiled;
}