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

This commit is contained in:
Twitchy 2011-06-20 18:49:26 +12:00
commit 2811a68002
2 changed files with 25 additions and 11 deletions

View file

@ -138,6 +138,7 @@ namespace TShockAPI
ChatCommands.Add(new Command("me", "", ThirdPerson));
ChatCommands.Add(new Command("p", "", PartyChat));
ChatCommands.Add(new Command("rules", "", Rules));
ChatCommands.Add(new Command("whitelist", "maintenance", Whitelist));
if (ConfigurationManager.DistributationAgent != "terraria-online")
{
ChatCommands.Add(new Command("kill", "kill", Kill));
@ -176,7 +177,6 @@ namespace TShockAPI
if (cmd == null)
{
player.SendMessage("That command does not exist, try /help", Color.Red);
}
else
{
@ -853,6 +853,17 @@ namespace TShockAPI
#region General Commands
public static void Whitelist(CommandArgs args)
{
if (args.Parameters.Count == 1)
{
TextWriter tw = new StreamWriter(FileTools.WhitelistPath, true);
tw.WriteLine(args.Parameters[0]);
tw.Close();
args.Player.SendMessage("Added " + args.Parameters[0] + " to the whitelist.");
}
}
private static void Help(CommandArgs args)
{
args.Player.SendMessage("TShock Commands:");

View file

@ -412,20 +412,23 @@ namespace TShockAPI
public static void Teleport(int ply, int x, int y)
{
Main.player[ply].position.X = x;
Main.player[ply].position.Y = y;
NetMessage.SendData(0x0d, -1, ply, "", ply);
NetMessage.SendData(0x0d, -1, -1, "", ply);
NetMessage.syncPlayers();
int oldSpawnX = Main.spawnTileX;
int oldSpawnY = Main.spawnTileY;
Main.spawnTileX = x;
Main.spawnTileY = y;
//Send only that player the new spawn point data
NetMessage.SendData(7, ply, -1, "", 0, 0f, 0f, 0f);
//Force them to respawn
NetMessage.SendData(12, ply, -1, "", ply, 0.0f, 0.0f, 0.0f);
//Reset to old spawnpoint and send spawn data back to player
Main.spawnTileX = (int)oldSpawnX;
Main.spawnTileY = (int)oldSpawnY;
NetMessage.SendData(7, ply, -1, "", 0, 0f, 0f, 0f);
}
public static void Teleport(int ply, float x, float y)
{
Main.player[ply].position.X = x;
Main.player[ply].position.Y = y;
NetMessage.SendData(0x0d, -1, ply, "", ply);
NetMessage.SendData(0x0d, -1, -1, "", ply);
NetMessage.syncPlayers();
Teleport(ply, (int)x, (int)y);
}
public static void StartInvasion()