/rules now follows MOTD formatting rules.
Tools.ShowMOTD is deprecated, use Tools.ShowFileToUser instead.
This commit is contained in:
parent
b8b4b6c8e8
commit
37d40374be
2 changed files with 12 additions and 15 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -342,15 +342,20 @@ namespace TShockAPI
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shows a MOTD to the player
|
||||
/// </summary>
|
||||
/// <param name="ply">int player</param>
|
||||
[Obsolete("Use ShowFileToUser(int ply, string file) instead.")]
|
||||
public static void ShowMOTD(int ply)
|
||||
{
|
||||
ShowFileToUser(ply, "motd.txt");
|
||||
}
|
||||
/// <summary>
|
||||
/// Shows a file to the user.
|
||||
/// </summary>
|
||||
/// <param name="ply">int player</param>
|
||||
/// <param name="file">string filename reletave to savedir</param>
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue