Merge branch 'master' of git://github.com/TShock/TShock

This commit is contained in:
Twitchy 2011-06-21 16:13:49 +12:00
commit 93e381a0a7
9 changed files with 98 additions and 56 deletions

View file

@ -177,19 +177,18 @@ namespace TShockAPI
if (cmd == null)
{
return false;
}
if (!cmd.CanRun(player))
{
Tools.SendLogs(string.Format("{0} tried to execute {1}", player.Name, cmd.Name), Color.Red);
player.SendMessage("You do not have access to that command.", Color.Red);
}
else
{
if (!cmd.CanRun(player))
{
Tools.SendLogs(string.Format("{0} tried to execute {1}", player.Name, cmd.Name), Color.Red);
player.SendMessage("You do not have access to that command.", Color.Red);
}
else
{
Tools.SendLogs(string.Format("{0} executed: /{1}", player.Name, cmdText), Color.Red);
cmd.Run(cmdText, player, args);
}
Tools.SendLogs(string.Format("{0} executed: /{1}", player.Name, cmdText), Color.Red);
cmd.Run(cmdText, player, args);
}
return true;
}
@ -655,20 +654,38 @@ namespace TShockAPI
private static void Home(CommandArgs args)
{
TShock.Teleport(args.Player.Index, args.TPlayer.SpawnX * 16 + 8 - args.TPlayer.width / 2,
args.TPlayer.SpawnY * 16 - args.TPlayer.height);
if (!args.Player.RealPlayer)
{
args.Player.SendMessage("You cant use teleport commands!");
return;
}
args.Player.Spawn();
args.Player.SendMessage("Teleported to your spawnpoint.");
}
private static void Spawn(CommandArgs args)
{
TShock.Teleport(args.Player.Index, Main.spawnTileX * 16 + 8 - args.TPlayer.width / 2,
Main.spawnTileY * 16 - args.TPlayer.height);
args.Player.SendMessage("Teleported to the map's spawnpoint.");
if (!args.Player.RealPlayer)
{
args.Player.SendMessage("You cant use teleport commands!");
return;
}
if (args.Player.Teleport(Main.spawnTileX, Main.spawnTileY))
args.Player.SendMessage("Teleported to the map's spawnpoint.");
else
args.Player.SendMessage("Can't teleport because you have set custom spawnpoint.", Color.Red);
}
private static void TP(CommandArgs args)
{
if (!args.Player.RealPlayer)
{
args.Player.SendMessage("You cant use teleport commands!");
return;
}
if (args.Parameters.Count < 1)
{
args.Player.SendMessage("Invalid syntax! Proper syntax: /tp <player> ", Color.Red);
@ -684,13 +701,21 @@ namespace TShockAPI
else
{
var plr = players[0];
TShock.Teleport(args.Player.Index, plr.X, plr.Y);
args.Player.SendMessage(string.Format("Teleported to {0}", plr.Name));
if (args.Player.Teleport(plr.TileX, plr.TileY))
args.Player.SendMessage(string.Format("Teleported to {0}", plr.Name));
else
args.Player.SendMessage("Can't teleport because you have set custom spawnpoint.", Color.Red);
}
}
private static void TPHere(CommandArgs args)
{
if (!args.Player.RealPlayer)
{
args.Player.SendMessage("You cant use teleport commands!");
return;
}
if (args.Parameters.Count < 1)
{
args.Player.SendMessage("Invalid syntax! Proper syntax: /tphere <player> ", Color.Red);
@ -710,9 +735,14 @@ namespace TShockAPI
else
{
var plr = players[0];
TShock.Teleport(plr.Index, args.Player.X, args.Player.Y);
plr.SendMessage(string.Format("You were teleported to {0}.", plr.Name));
args.Player.SendMessage(string.Format("You brought {0} here.", plr.Name));
if (plr.Teleport(args.Player.TileX, args.Player.TileY))
{
plr.SendMessage(string.Format("You were teleported to {0}.", plr.Name));
args.Player.SendMessage(string.Format("You brought {0} here.", plr.Name));
}
else
args.Player.SendMessage("Can't teleport because target player has set custom spawnpoint.", Color.Red);
}
}