forked from LeeIzaZombie/RocketMod_TPA
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCommandTpaAbort.cs
44 lines (38 loc) · 1.3 KB
/
CommandTpaAbort.cs
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
using System;
using System.Drawing;
using Rocket.API.Commands;
using Rocket.API.Player;
using Rocket.Core.I18N;
using Rocket.Core.Player;
using Rocket.Core.User;
namespace RocketMod_TPA
{
public class CommandTpaAbort : IChildCommand
{
private readonly PluginTpa _tpaPlugin;
public CommandTpaAbort(PluginTpa tpaPlugin)
{
_tpaPlugin = tpaPlugin;
}
public string Name => "Abort";
public string[] Aliases => new[] { "cancel" };
public string Summary => "Aborts a teleport request.";
public string Description => null;
public string Permission => "tpa.abort";
public string Syntax => "";
public IChildCommand[] ChildCommands => null;
public bool SupportsUser(Type user)
{
return typeof(IPlayerUser).IsAssignableFrom(user);
}
public void Execute(ICommandContext context)
{
var player = ((IPlayerUser)context.User).GetPlayer();
bool removed = _tpaPlugin.Requests.Remove(player);
if (removed)
context.User.SendLocalizedMessage(_tpaPlugin.Translations, "request_abort", Color.Yellow);
else
context.User.SendLocalizedMessage(_tpaPlugin.Translations, "request_none", Color.Red);
}
}
}