From 4d200ee24a050a6863cce23c589d43186488b09c Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Mon, 20 Jun 2011 00:06:03 -0600 Subject: [PATCH 1/5] Pretty sure that we don't need assume that there aren't other commands from other plugins. --- TShockAPI/Commands.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 33d9f7da..9192f6d8 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -176,7 +176,6 @@ namespace TShockAPI if (cmd == null) { - player.SendMessage("That command does not exist, try /help", Color.Red); } else { From b8c3b85cd98d72cbc5c07f0b559a016678b85945 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Mon, 20 Jun 2011 00:15:47 -0600 Subject: [PATCH 2/5] Teleportation fix thanks to Twitchy Closes #94 --- TShockAPI/TShock.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 2dfb1736..dff860db 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -412,11 +412,18 @@ 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) From dc27c5a2369b9a571538844018357e786b5adf2a Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Mon, 20 Jun 2011 00:17:08 -0600 Subject: [PATCH 3/5] Legacy teleport updated --- TShockAPI/TShock.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index dff860db..7c2e3d4e 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -428,11 +428,7 @@ namespace TShockAPI 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() From 5b0716c8ee9312068005e0753b50c6721f343688 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Mon, 20 Jun 2011 00:26:58 -0600 Subject: [PATCH 4/5] Added whitelist command. --- TShockAPI/Commands.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 9192f6d8..4baa8f1f 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -852,6 +852,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:"); From 4ae62f53a74c7045177d2e8dabbd75fe24661df3 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Mon, 20 Jun 2011 00:28:28 -0600 Subject: [PATCH 5/5] Added it for real this time. Closes #90 --- TShockAPI/Commands.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 4baa8f1f..a9eef720 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -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));