forked from LeeIzaZombie/RocketMod_TPA
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCommandTpaDeny.cs
49 lines (42 loc) · 1.56 KB
/
CommandTpaDeny.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
45
46
47
48
49
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 CommandTpaDeny : IChildCommand
{
private readonly PluginTpa _tpaPlugin;
public CommandTpaDeny(PluginTpa tpaPlugin)
{
_tpaPlugin = tpaPlugin;
}
public string Name => "Deny";
public string[] Aliases => new[] { "d", "no" };
public string Summary => "Denies the TPA request.";
public string Description => null;
public string Permission => "tpa.deny";
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();
if (_tpaPlugin.Requests.ContainsKey(player))
{
IPlayer teleporter = _tpaPlugin.Requests[player];
_tpaPlugin.Requests.Remove(player);
player.GetUser().SendLocalizedMessage(_tpaPlugin.Translations, "request_denied", Color.Yellow, teleporter.Name);
teleporter.GetUser().SendLocalizedMessage(_tpaPlugin.Translations, "request_denied_1", Color.Red, player.Name);
return;
}
player.GetUser().SendLocalizedMessage(_tpaPlugin.Translations, "request_none", Color.Red);
}
}
}