diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs
index f2923168..abb1ba1e 100755
--- a/TShockAPI/Commands.cs
+++ b/TShockAPI/Commands.cs
@@ -240,15 +240,7 @@ namespace TShockAPI
public static void Rules(CommandArgs args)
{
- TextReader sr = new StreamReader(FileTools.SaveDir + "rules.txt");
- string unsplit = sr.ReadToEnd();
- sr.Close();
-
- string[] split = unsplit.Split(Convert.ToChar("\n"));
- for (int i = 0; i < split.Length; i++)
- {
- Tools.SendMessage(args.PlayerID, split[i]);
- }
+ Tools.ShowFileToUser(args.PlayerID, "rules.txt");
}
public static void ToggleAntiBuild(CommandArgs args)
diff --git a/TShockAPI/Tools.cs b/TShockAPI/Tools.cs
index ed0e7a78..f818bb11 100755
--- a/TShockAPI/Tools.cs
+++ b/TShockAPI/Tools.cs
@@ -342,15 +342,20 @@ namespace TShockAPI
}
return false;
}
-
- ///
- /// Shows a MOTD to the player
- ///
- /// int player
+ [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
+ public static void ShowFileToUser(int ply, string file)
{
string foo = "";
- TextReader tr = new StreamReader(FileTools.SaveDir + "motd.txt");
+ TextReader tr = new StreamReader(FileTools.SaveDir + file);
while ((foo = tr.ReadLine()) != null)
{
foo = foo.Replace("%map%", Main.worldName);