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.

This commit is contained in:
Zack Piispanen 2014-03-02 19:49:59 -05:00
parent fee116c6df
commit 0f3156b4ac
3 changed files with 7 additions and 5 deletions

View file

@ -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);
}
}

View file

@ -281,7 +281,9 @@ namespace TShockAPI
[Description("Allows anyone to break grass, pots, etc.")] public bool AllowCutTilesAndBreakables = false;
/// <summary>
[Description("Specifies which string starts a command")] public string CommandSpecifier = "/";
/// <summary>
/// Reads a configuration file from a given path
/// </summary>
/// <param name="path">string path</param>

View file

@ -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
{