Guard against tp commands run from server console
This commit is contained in:
parent
aa9d627f69
commit
9106a56524
1 changed files with 24 additions and 0 deletions
|
|
@ -654,12 +654,24 @@ namespace TShockAPI
|
||||||
|
|
||||||
private static void Home(CommandArgs args)
|
private static void Home(CommandArgs args)
|
||||||
{
|
{
|
||||||
|
if (!args.Player.RealPlayer)
|
||||||
|
{
|
||||||
|
args.Player.SendMessage("You cant use teleport commands!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
args.Player.Spawn();
|
args.Player.Spawn();
|
||||||
args.Player.SendMessage("Teleported to your spawnpoint.");
|
args.Player.SendMessage("Teleported to your spawnpoint.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Spawn(CommandArgs args)
|
private static void Spawn(CommandArgs args)
|
||||||
{
|
{
|
||||||
|
if (!args.Player.RealPlayer)
|
||||||
|
{
|
||||||
|
args.Player.SendMessage("You cant use teleport commands!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (args.Player.Teleport(Main.spawnTileX, Main.spawnTileY))
|
if (args.Player.Teleport(Main.spawnTileX, Main.spawnTileY))
|
||||||
args.Player.SendMessage("Teleported to the map's spawnpoint.");
|
args.Player.SendMessage("Teleported to the map's spawnpoint.");
|
||||||
else
|
else
|
||||||
|
|
@ -668,6 +680,12 @@ namespace TShockAPI
|
||||||
|
|
||||||
private static void TP(CommandArgs args)
|
private static void TP(CommandArgs args)
|
||||||
{
|
{
|
||||||
|
if (!args.Player.RealPlayer)
|
||||||
|
{
|
||||||
|
args.Player.SendMessage("You cant use teleport commands!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (args.Parameters.Count < 1)
|
if (args.Parameters.Count < 1)
|
||||||
{
|
{
|
||||||
args.Player.SendMessage("Invalid syntax! Proper syntax: /tp <player> ", Color.Red);
|
args.Player.SendMessage("Invalid syntax! Proper syntax: /tp <player> ", Color.Red);
|
||||||
|
|
@ -692,6 +710,12 @@ namespace TShockAPI
|
||||||
|
|
||||||
private static void TPHere(CommandArgs args)
|
private static void TPHere(CommandArgs args)
|
||||||
{
|
{
|
||||||
|
if (!args.Player.RealPlayer)
|
||||||
|
{
|
||||||
|
args.Player.SendMessage("You cant use teleport commands!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (args.Parameters.Count < 1)
|
if (args.Parameters.Count < 1)
|
||||||
{
|
{
|
||||||
args.Player.SendMessage("Invalid syntax! Proper syntax: /tphere <player> ", Color.Red);
|
args.Player.SendMessage("Invalid syntax! Proper syntax: /tphere <player> ", Color.Red);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue