Added /rules, reads from ./tshock/rules.txt
This commit is contained in:
parent
7e8e8fb986
commit
b8b4b6c8e8
2 changed files with 22 additions and 0 deletions
|
|
@ -223,6 +223,7 @@ namespace TShockAPI
|
||||||
commands.Add(new Command("auth", "", AuthToken));
|
commands.Add(new Command("auth", "", AuthToken));
|
||||||
commands.Add(new Command("me", "", ThirdPerson));
|
commands.Add(new Command("me", "", ThirdPerson));
|
||||||
commands.Add(new Command("p", "", PartyChat));
|
commands.Add(new Command("p", "", PartyChat));
|
||||||
|
commands.Add(new Command("rules", "", Rules));
|
||||||
commands.Add(new Command("antibuild", "editspawn", ToggleAntiBuild));
|
commands.Add(new Command("antibuild", "editspawn", ToggleAntiBuild));
|
||||||
if (ConfigurationManager.distributationAgent != "terraria-online")
|
if (ConfigurationManager.distributationAgent != "terraria-online")
|
||||||
{
|
{
|
||||||
|
|
@ -237,6 +238,19 @@ namespace TShockAPI
|
||||||
|
|
||||||
#region Command Methods
|
#region Command Methods
|
||||||
|
|
||||||
|
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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void ToggleAntiBuild(CommandArgs args)
|
public static void ToggleAntiBuild(CommandArgs args)
|
||||||
{
|
{
|
||||||
Tools.SendMessage(args.PlayerID, "Toggled world anti-build.");
|
Tools.SendMessage(args.PlayerID, "Toggled world anti-build.");
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,14 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(SaveDir);
|
Directory.CreateDirectory(SaveDir);
|
||||||
}
|
}
|
||||||
|
if (!File.Exists(SaveDir + "rules.txt"))
|
||||||
|
{
|
||||||
|
CreateFile(SaveDir + "rules.txt");
|
||||||
|
TextWriter tw = new StreamWriter(SaveDir + "rules.txt");
|
||||||
|
tw.WriteLine("Respect the admins!");
|
||||||
|
tw.WriteLine("Don't use TNT!");
|
||||||
|
tw.Close();
|
||||||
|
}
|
||||||
if (!File.Exists(SaveDir + "motd.txt"))
|
if (!File.Exists(SaveDir + "motd.txt"))
|
||||||
{
|
{
|
||||||
CreateFile(SaveDir + "motd.txt");
|
CreateFile(SaveDir + "motd.txt");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue