From 0f3156b4ac7c1db0894805c422d3cc7d91825ba3 Mon Sep 17 00:00:00 2001 From: Zack Piispanen Date: Sun, 2 Mar 2014 19:49:59 -0500 Subject: [PATCH] Added config to allow the choice for what string starts a command, ie '/login' can become '.login'. Changing this from default will introduce inconsistencies with plugins and help text, you have been warned. --- TShockAPI/Commands.cs | 6 +++--- TShockAPI/ConfigFile.cs | 4 +++- TShockAPI/TShock.cs | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 72e7ff34..19ccd9ed 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -572,14 +572,14 @@ namespace TShockAPI call(new CommandArgs(cmdText, player, args)); return true; } - player.SendErrorMessage("Invalid command entered. Type /help for a list of valid commands."); + player.SendErrorMessage("Invalid command entered. Type {0}help for a list of valid commands.", TShock.Config.CommandSpecifier); return true; } foreach (Command cmd in cmds) { if (!cmd.CanRun(player)) { - TShock.Utils.SendLogs(string.Format("{0} tried to execute /{1}.", player.Name, cmdText), Color.PaleVioletRed, player); + TShock.Utils.SendLogs(string.Format("{0} tried to execute {1}{2}.", player.Name, TShock.Config.CommandSpecifier, cmdText), Color.PaleVioletRed, player); player.SendErrorMessage("You do not have access to this command."); } else if (!cmd.AllowServer && !player.RealPlayer) @@ -589,7 +589,7 @@ namespace TShockAPI else { if (cmd.DoLog) - TShock.Utils.SendLogs(string.Format("{0} executed: /{1}.", player.Name, cmdText), Color.PaleVioletRed, player); + TShock.Utils.SendLogs(string.Format("{0} executed: {1}{2}.", player.Name, TShock.Config.CommandSpecifier, cmdText), Color.PaleVioletRed, player); cmd.Run(cmdText, player, args); } } diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index bebfc148..f2d7b400 100755 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -281,7 +281,9 @@ namespace TShockAPI [Description("Allows anyone to break grass, pots, etc.")] public bool AllowCutTilesAndBreakables = false; - /// + [Description("Specifies which string starts a command")] public string CommandSpecifier = "/"; + + /// /// Reads a configuration file from a given path /// /// string path diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 990a92f9..e1481fd4 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1042,7 +1042,7 @@ namespace TShockAPI return; }*/ - if (args.Text.StartsWith("/") && args.Text.Length > 1) + if (args.Text.StartsWith(Config.CommandSpecifier) && args.Text.Length > 1) { try {