diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs
index 963b9625..36a7f1c9 100755
--- a/TShockAPI/Commands.cs
+++ b/TShockAPI/Commands.cs
@@ -229,7 +229,7 @@ namespace TShockAPI
public static void Rules(CommandArgs args)
{
- Tools.ShowFileToUser(args.PlayerID, "rules.txt");
+ Tools.ShowFileToUser(args.Player, "rules.txt");
}
public static void ToggleAntiBuild(CommandArgs args)
diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs
index ed7065dc..3cf083c6 100755
--- a/TShockAPI/TShock.cs
+++ b/TShockAPI/TShock.cs
@@ -631,9 +631,10 @@ namespace TShockAPI
if (Main.netMode != 2)
return;
- Log.Info(string.Format("{0} ({1}) from '{2}' group joined.", Players[who].Name, Tools.GetPlayerIP(who), Players[who].Group.Name));
+ TSPlayer player = Players[who];
+ Log.Info(string.Format("{0} ({1}) from '{2}' group joined.", player.Name, Tools.GetPlayerIP(who), player.Group.Name));
- Tools.ShowMOTD(who);
+ Tools.ShowFileToUser(player, "motd.txt");
if (HackedHealth(who))
{
Tools.HandleCheater(who, "Hacked health.");
diff --git a/TShockAPI/Tools.cs b/TShockAPI/Tools.cs
index 7103009c..24ac34e9 100755
--- a/TShockAPI/Tools.cs
+++ b/TShockAPI/Tools.cs
@@ -291,18 +291,14 @@ namespace TShockAPI
}
return false;
}
- [Obsolete("Use ShowFileToUser(int ply, string file) instead.")]
- public static void ShowMOTD(int ply)
- {
- ShowFileToUser(ply, "motd.txt");
- }
+
///
/// Shows a file to the user.
///
/// int player
/// string filename reletave to savedir
//Todo: Fix this
- public static void ShowFileToUser(int ply, string file)
+ public static void ShowFileToUser(TSPlayer player, string file)
{
string foo = "";
TextReader tr = new StreamReader(Path.Combine(TShock.SavePath, file));
@@ -321,7 +317,7 @@ namespace TShockAPI
{
try
{
- TShock.Players[ply].SendMessage(foo, (byte)Convert.ToInt32(pCc[0]), (byte)Convert.ToInt32(pCc[1]), (byte)Convert.ToInt32(pCc[2]));
+ player.SendMessage(foo, (byte)Convert.ToInt32(pCc[0]), (byte)Convert.ToInt32(pCc[1]), (byte)Convert.ToInt32(pCc[2]));
continue;
}
catch (Exception e)
@@ -330,7 +326,7 @@ namespace TShockAPI
}
}
}
- TShock.Players[ply].SendMessage(foo);
+ player.SendMessage(foo);
}
tr.Close();
}