-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExplodeCommand.cs
More file actions
45 lines (40 loc) · 1.54 KB
/
ExplodeCommand.cs
File metadata and controls
45 lines (40 loc) · 1.54 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
40
41
42
43
44
45
using LabExtended.API;
using LabExtended.Commands;
using LabExtended.Commands.Attributes;
using LabExtended.Commands.Interfaces;
using SecretLabAPI.Extensions;
namespace SecretLabAPI.Commands
{
/// <summary>
/// Represents a server-side command that explodes specified players using a given item and velocity.
/// </summary>
[Command("explode", "Explodes specified players with given item and velocity.")]
public class ExplodeCommand : CommandBase, IServerSideCommand
{
[CommandOverload("Explodes specified players with given item and velocity.", "explode")]
private void Execute(
[CommandParameter("Players", "List of players to explode.")] List<ExPlayer> players,
[CommandParameter("Item", "The item to use for the explosion.")] ItemType item,
[CommandParameter("Amount", "Amount of explosions to spawn.")] int amount,
[CommandParameter("Velocity", "The velocity of the explosion.")] float velocity,
[CommandParameter("Reason", "The reason for the explosion.")] string reason = "Game Over")
{
var count = 0;
players.ForEach(p =>
{
if (p.Explode(amount, item, reason, false, true, velocity))
{
count++;
}
});
if (count > 0)
{
Ok($"Successfully exploded {count} players.");
}
else
{
Fail("No players were exploded.");
}
}
}
}