/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)
|
public static void Rules(CommandArgs args)
|
||||||
{
|
{
|
||||||
TextReader sr = new StreamReader(FileTools.SaveDir + "rules.txt");
|
Tools.ShowFileToUser(args.PlayerID, "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]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ToggleAntiBuild(CommandArgs args)
|
public static void ToggleAntiBuild(CommandArgs args)
|
||||||
|
|
|
||||||
|
|
@ -342,15 +342,20 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
[Obsolete("Use ShowFileToUser(int ply, string file) instead.")]
|
||||||
/// <summary>
|
|
||||||
/// Shows a MOTD to the player
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ply">int player</param>
|
|
||||||
public static void ShowMOTD(int ply)
|
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 = "";
|
string foo = "";
|
||||||
TextReader tr = new StreamReader(FileTools.SaveDir + "motd.txt");
|
TextReader tr = new StreamReader(FileTools.SaveDir + file);
|
||||||
while ((foo = tr.ReadLine()) != null)
|
while ((foo = tr.ReadLine()) != null)
|
||||||
{
|
{
|
||||||
foo = foo.Replace("%map%", Main.worldName);
|
foo = foo.Replace("%map%", Main.worldName);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue