Skip to content

Commit 7f39c59

Browse files
committed
Add tpr and added /tpa <playerName>
1 parent ab7b9bf commit 7f39c59

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

Feli.RocketMod.Teleporting/Commands/TpaCommand.cs

+23-10
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ public void Execute(IRocketPlayer caller, string[] command)
1313
var plugin = Plugin.Instance;
1414
var messageColor = plugin.MessageColor;
1515
var messageIcon = plugin.Configuration.Instance.MessageIcon;
16-
16+
1717
if (command.Length < 1)
1818
{
1919
Say(caller, plugin.Translate("TpaCommand:WrongUsage"), messageColor, messageIcon);
2020
return;
2121
}
22-
22+
2323
var player = (UnturnedPlayer) caller;
24-
24+
2525
var type = command[0].ToLower();
26-
26+
2727
var teleportsManager = plugin.TeleportsManager;
2828

2929
if (type == "s" | type == "send")
@@ -38,21 +38,31 @@ public void Execute(IRocketPlayer caller, string[] command)
3838

3939
if (target == null)
4040
{
41-
Say(caller, plugin.Translate("TpaCommand:WrongUsage:NotFound", command[1]), messageColor, messageIcon);
41+
Say(caller, plugin.Translate("TpaCommand:WrongUsage:NotFound", command[1]), messageColor,
42+
messageIcon);
4243
return;
4344
}
44-
45+
4546
teleportsManager.Send(player, target);
4647
}
4748
else if (type == "a" | type == "accept")
4849
teleportsManager.Accept(player);
4950
else if (type == "c" | type == "cancel")
5051
teleportsManager.Cancel(player);
51-
else if(type == "l" | type == "list")
52+
else if (type == "l" | type == "list")
5253
teleportsManager.List(player);
5354
else
5455
{
55-
Say(caller, plugin.Translate("TpaCommand:WrongUsage"), messageColor, messageIcon);
56+
var target = UnturnedPlayer.FromName(command[0]);
57+
58+
if (target == null)
59+
{
60+
Say(caller, plugin.Translate("TpaCommand:WrongUsage:NotFound", command[0]), messageColor,
61+
messageIcon);
62+
return;
63+
}
64+
65+
teleportsManager.Send(player, target);
5666
}
5767
}
5868

@@ -66,8 +76,11 @@ private void Say(IRocketPlayer rocketPlayer, string message, Color messageColor,
6676
public AllowedCaller AllowedCaller => AllowedCaller.Player;
6777
public string Name => "tpa";
6878
public string Help => "Send, accept, deny and cancel teleport requests";
69-
public string Syntax => "<accept|send|cancel|list>";
70-
public List<string> Aliases => new List<string>();
79+
public string Syntax => "<playerName|accept|send|cancel|list>";
80+
public List<string> Aliases => new List<string>()
81+
{
82+
"tpr"
83+
};
7184
public List<string> Permissions => new List<string>();
7285
}
7386
}

Feli.RocketMod.Teleporting/Plugin.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ protected override void Unload()
3838

3939
public override TranslationList DefaultTranslations => new TranslationList()
4040
{
41-
{"TpaCommand:WrongUsage", "Correct command usage: /tpa <accept|send|cancel|list>"},
41+
{"TpaCommand:WrongUsage", "Correct command usage: /tpa <playerName|accept|send|cancel|list>"},
4242
{"TpaCommand:WrongUsage:Send", "Correct command usage: /tpa send <playerName>"},
4343
{"TpaCommand:WrongUsage:NotFound", "Player with name {0} was not found"},
4444
{"TpaCommand:Send:Yourself", "There is no point on sending a tpa request to yourself"},

0 commit comments

Comments
 (0)