Made console change text color depending on messages
This commit is contained in:
parent
16a90f3240
commit
1d5ac77255
4 changed files with 14 additions and 1 deletions
|
|
@ -70,14 +70,18 @@ namespace TShockAPI
|
|||
Tools.Broadcast("Server map saving, potential lag spike");
|
||||
WorldGen.saveWorld();
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("World backed up");
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
Log.Info(string.Format("World backed up ({0})", Main.worldPathName));
|
||||
|
||||
Main.worldPathName = worldname;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine("Backup failed");
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
Log.Error("Backup failed");
|
||||
Log.Error(ex.ToString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,9 @@ namespace TShockAPI
|
|||
/// <param name="message">The message to be written.</param>
|
||||
public static void ConsoleError(String message)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine(message);
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
Write(message, LogLevel.Error);
|
||||
}
|
||||
|
||||
|
|
@ -114,7 +116,9 @@ namespace TShockAPI
|
|||
/// <param name="message">The message to be written.</param>
|
||||
public static void ConsoleInfo(String message)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine(message);
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
Write(message, LogLevel.Info);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -280,7 +280,9 @@ namespace TShockAPI
|
|||
|
||||
public override void SendMessage(string msg, byte red, byte green, byte blue)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.WriteLine(msg);
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
}
|
||||
|
||||
public void SetBloodMoon(bool bloodMoon)
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ namespace TShockAPI
|
|||
public static TSPlayer[] Players = new TSPlayer[Main.maxPlayers];
|
||||
public static BanManager Bans;
|
||||
public static WarpManager Warps;
|
||||
public static RegionManager Regions;
|
||||
public static BackupManager Backups;
|
||||
|
||||
public static ConfigFile Config { get; set; }
|
||||
|
|
@ -112,6 +113,7 @@ namespace TShockAPI
|
|||
|
||||
Bans = new BanManager(DB);
|
||||
Warps = new WarpManager(DB);
|
||||
Regions = new RegionManager(DB);
|
||||
|
||||
Log.ConsoleInfo(string.Format("TShock Version {0} ({1}) now running.", Version, VersionCodename));
|
||||
|
||||
|
|
@ -128,7 +130,6 @@ namespace TShockAPI
|
|||
|
||||
GetDataHandlers.InitGetDataHandler();
|
||||
Commands.InitCommands();
|
||||
RegionManager.ReadAllSettings();
|
||||
ItemManager.LoadBans();
|
||||
|
||||
Log.ConsoleInfo("AutoSave " + (TShock.Config.AutoSave ? "Enabled" : "Disabled"));
|
||||
|
|
@ -209,8 +210,10 @@ namespace TShockAPI
|
|||
{
|
||||
var r = new Random((int)DateTime.Now.ToBinary());
|
||||
AuthToken = r.Next(100000, 10000000);
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("TShock Notice: To become SuperAdmin, join the game and type /auth " + AuthToken);
|
||||
Console.WriteLine("This token will only display ONCE. This only works ONCE. If you don't use it and the server goes down, delete auth.lck.");
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
FileTools.CreateFile(Path.Combine(SavePath, "auth.lck"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue