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:
parent
fee116c6df
commit
0f3156b4ac
3 changed files with 7 additions and 5 deletions
|
|
@ -572,14 +572,14 @@ namespace TShockAPI
|
||||||
call(new CommandArgs(cmdText, player, args));
|
call(new CommandArgs(cmdText, player, args));
|
||||||
return true;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
foreach (Command cmd in cmds)
|
foreach (Command cmd in cmds)
|
||||||
{
|
{
|
||||||
if (!cmd.CanRun(player))
|
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.");
|
player.SendErrorMessage("You do not have access to this command.");
|
||||||
}
|
}
|
||||||
else if (!cmd.AllowServer && !player.RealPlayer)
|
else if (!cmd.AllowServer && !player.RealPlayer)
|
||||||
|
|
@ -589,7 +589,7 @@ namespace TShockAPI
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (cmd.DoLog)
|
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);
|
cmd.Run(cmdText, player, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -281,6 +281,8 @@ namespace TShockAPI
|
||||||
|
|
||||||
[Description("Allows anyone to break grass, pots, etc.")] public bool AllowCutTilesAndBreakables = false;
|
[Description("Allows anyone to break grass, pots, etc.")] public bool AllowCutTilesAndBreakables = false;
|
||||||
|
|
||||||
|
[Description("Specifies which string starts a command")] public string CommandSpecifier = "/";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reads a configuration file from a given path
|
/// Reads a configuration file from a given path
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -1042,7 +1042,7 @@ namespace TShockAPI
|
||||||
return;
|
return;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if (args.Text.StartsWith("/") && args.Text.Length > 1)
|
if (args.Text.StartsWith(Config.CommandSpecifier) && args.Text.Length > 1)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue