From eb8d1e180f0227b5fdd9de413bca3b58efa0173d Mon Sep 17 00:00:00 2001 From: ricky Date: Thu, 9 Jun 2011 11:52:14 +1000 Subject: [PATCH] Killed the Obsolete SendMessage method --- TShockAPI/Commands.cs | 14 +++++++------- TShockAPI/TShock.cs | 7 ++----- TShockAPI/Tools.cs | 11 +---------- TShockAPI/UpdateManager.cs | 3 ++- 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 78e820cf..4f31f447 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -261,24 +261,24 @@ namespace TShockAPI lineOne += "BanCheater : " + ConfigurationManager.banCheater + ", "; lineOne += "KickGriefer : " + ConfigurationManager.kickGriefer + ", "; lineOne += "BanGriefer : " + ConfigurationManager.banGriefer; - Tools.SendMessage(ply, lineOne, 255f, 255f, 0f); + Tools.SendMessage(ply, lineOne, Color.Yellow); string lineTwo = ""; lineTwo += "BanTnt : " + ConfigurationManager.banTnt + ", "; lineTwo += "KickTnt : " + ConfigurationManager.kickTnt + ", "; lineTwo += "BanBoom : " + ConfigurationManager.banBoom + ", "; lineTwo += "KickBoom : " + ConfigurationManager.kickBoom; - Tools.SendMessage(ply, lineTwo, 255f, 255f, 0f); + Tools.SendMessage(ply, lineTwo, Color.Yellow); string lineThree = ""; lineThree += "InvMultiplier : " + ConfigurationManager.invasionMultiplier + ", "; lineThree += "ProtectS : " + ConfigurationManager.spawnProtect + ", "; lineThree += "ProtectR : " + ConfigurationManager.spawnProtectRadius + ", "; lineThree += "DMS : " + ConfigurationManager.defaultMaxSpawns + ", "; lineThree += "SpawnRate: " + ConfigurationManager.defaultSpawnRate; - Tools.SendMessage(ply, lineThree, 255f, 255f, 0f); + Tools.SendMessage(ply, lineThree, Color.Yellow); string lineFour = ""; lineFour += "MaxSlots : " + ConfigurationManager.maxSlots + ", "; lineFour += "RangeChecks : " + ConfigurationManager.rangeChecks + ", "; - Tools.SendMessage(ply, lineFour, 255f, 255f, 0f); + Tools.SendMessage(ply, lineFour, Color.Yellow); } public static void Kick(CommandArgs args) @@ -823,19 +823,19 @@ namespace TShockAPI tempstring += "/" + cmdlist[j].Name() + ", "; if (j == cmdlist.Count - 1) { - Tools.SendMessage(ply, tempstring.TrimEnd(new[] { ' ', ',' }), new[] { 255f, 255f, 0f }); + Tools.SendMessage(ply, tempstring.TrimEnd(new[] { ' ', ',' }), Color.Yellow); break; } if ((j + 1) % 5 == 0) { - Tools.SendMessage(ply, tempstring.TrimEnd(new[] { ' ', ',' }), new[] { 255f, 255f, 0f }); + Tools.SendMessage(ply, tempstring.TrimEnd(new[] { ' ', ',' }), Color.Yellow); tempstring = ""; } } } if (cmdlist.Count > (15 * page)) { - Tools.SendMessage(ply, "Type /help " + (page + 1) + " for more commands.", new[] { 255f, 0f, 255f }); + Tools.SendMessage(ply, "Type /help " + (page + 1) + " for more commands.", Color.Yellow); } } diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 08b07b3d..92fbcd9e 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -336,8 +336,7 @@ namespace TShockAPI var flag = CheckSpawn(x, y); if (flag) { - Tools.SendMessage(e.Msg.whoAmI, "Spawn protected from changes.", - new[] { 255f, 0f, 0f }); + Tools.SendMessage(e.Msg.whoAmI, "Spawn protected from changes.", Color.Red); return true; } } @@ -521,7 +520,7 @@ namespace TShockAPI var flag = CheckSpawn(x, y); if (flag) { - Tools.SendMessage(e.Msg.whoAmI, "The spawn is protected!", new[] { 255f, 0f, 0f }); + Tools.SendMessage(e.Msg.whoAmI, "The spawn is protected!", Color.Red); return true; } } @@ -673,8 +672,6 @@ namespace TShockAPI Console.WriteLine("This token will only display ONCE. This only works ONCE. If you don't use it and the server goes down, delete auth.lck."); FileTools.CreateFile(FileTools.SaveDir + "auth.lck"); } - - //ConfigurationManager.maxSlots = Main.maxPlayers - 1; } private void OnUpdate(GameTime time) diff --git a/TShockAPI/Tools.cs b/TShockAPI/Tools.cs index e0953979..067306de 100755 --- a/TShockAPI/Tools.cs +++ b/TShockAPI/Tools.cs @@ -95,12 +95,6 @@ namespace TShockAPI Log.Info("Broadcast: " + msg); } - [Obsolete("STOP USING THIS")] - public static void SendMessage(int ply, string msg, float[] colors) - { - SendMessage(ply, msg, colors[0],colors[1],colors[2]); - } - /// /// Sends a message out to a single player /// @@ -357,10 +351,7 @@ namespace TShockAPI { try { - pC[0] = Clamp(Convert.ToInt32(pCc[0]), 255, 0); - pC[1] = Clamp(Convert.ToInt32(pCc[1]), 255, 0); - pC[2] = Clamp(Convert.ToInt32(pCc[2]), 255, 0); - SendMessage(ply, foo, pC); + SendMessage(ply, foo, Clamp(Convert.ToInt32(pCc[0]), 255, 0), Clamp(Convert.ToInt32(pCc[1]), 255, 0), Clamp(Convert.ToInt32(pCc[2]), 255, 0)); continue; } catch (Exception e) diff --git a/TShockAPI/UpdateManager.cs b/TShockAPI/UpdateManager.cs index 5c8dab3e..22f64db8 100644 --- a/TShockAPI/UpdateManager.cs +++ b/TShockAPI/UpdateManager.cs @@ -5,6 +5,7 @@ using System.Net; using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.Xna.Framework; using Terraria; namespace TShockAPI @@ -64,7 +65,7 @@ namespace TShockAPI Tools.SendMessage(i, "The server is out of date. To update, type /updatenow."); for (int j = 4; j < changes.Length; j++) { - Tools.SendMessage(i, changes[j], 255, 0, 0); + Tools.SendMessage(i, changes[j], Color.Red); } } }