diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 261e2ae8..a65d3baf 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -146,6 +146,8 @@ namespace TShockAPI ChatCommands.Add(new Command("displaylogs", "logs", Rules)); ChatCommands.Add(new Command("user", "manageusers", ManageUsers)); ChatCommands.Add(new Command("login", "", AttemptLogin)); + ChatCommands.Add(new Command("broadcast", "cfg", Broadcast)); + ChatCommands.Add(new Command("bc", "cfg", Broadcast)); if (ConfigurationManager.DistributationAgent != "terraria-online") { ChatCommands.Add(new Command("kill", "kill", Kill)); @@ -516,6 +518,19 @@ namespace TShockAPI #region Server Maintenence Commands + private static void Broadcast(CommandArgs args) + { + string message = ""; + + for (int i = 0; i < args.Parameters.Count; i++) + { + message += args.Parameters[i]; + } + + Tools.Broadcast("(Server Broadcast) " + message, Color.Red); + return; + } + private static void Off(CommandArgs args) { Tools.ForceKickAll("Server shutting down!"); diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index ec5cc17b..bbfc2d09 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -61,5 +61,7 @@ namespace TShockAPI public bool AutoSave = true; public int MaximumLoginAttempts = 3; + + public bool EnableOptionalAlwaysOnAdminChatColor = true; } } \ No newline at end of file diff --git a/TShockAPI/ConfigurationManager.cs b/TShockAPI/ConfigurationManager.cs index 400f30d6..cf0801c3 100644 --- a/TShockAPI/ConfigurationManager.cs +++ b/TShockAPI/ConfigurationManager.cs @@ -58,6 +58,7 @@ namespace TShockAPI public static bool RememberLeavePos = false; public static int TileThreshold = 20; public static int MaximumLoginAttempts = 3; + public static bool AdminChatOptional = true; /// /// Don't allow pvp changing for x seconds. @@ -122,6 +123,7 @@ namespace TShockAPI BanOnHardcoreDeath = cfg.BanOnHardcoreOnlyDeath; AutoSave = cfg.AutoSave; MaximumLoginAttempts = cfg.MaximumLoginAttempts; + AdminChatOptional = cfg.EnableOptionalAlwaysOnAdminChatColor; } public static void WriteJsonConfiguration() @@ -161,6 +163,7 @@ namespace TShockAPI cfg.KickOnHardcoreOnlyDeath = KickOnHardcoreDeath; cfg.AutoSave = AutoSave; cfg.MaximumLoginAttempts = MaximumLoginAttempts; + cfg.EnableOptionalAlwaysOnAdminChatColor = AdminChatOptional; string json = JsonConvert.SerializeObject(cfg, Formatting.Indented); TextWriter tr = new StreamWriter(FileTools.ConfigPath); tr.Write(json); diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index c2654f44..0eea86fa 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -315,7 +315,7 @@ namespace TShockAPI return; } - if (tsplr.Group.HasPermission("adminchat") && !text.StartsWith("/")) + if (tsplr.Group.HasPermission("adminchat") && !text.StartsWith("/") && ConfigurationManager.AdminChatOptional) { Tools.Broadcast(ConfigurationManager.AdminChatPrefix + "<" + tsplr.Name + "> " + text, (byte)ConfigurationManager.AdminChatRGB[0], (byte)ConfigurationManager.AdminChatRGB[1], (byte)ConfigurationManager.AdminChatRGB[2]);