This commit is contained in:
Simon 2016-10-16 08:58:55 +03:00
parent bba0d72a29
commit 54915bcf47
2 changed files with 29 additions and 6 deletions

View file

@ -628,12 +628,29 @@ namespace TShockAPI
if (cmdPrefix == SilentSpecifier)
silent = true;
var args = ParseParameters(cmdText);
if (args.Count < 1)
return false;
int index = -1;
for (int i = 0; i < cmdText.Length; i++)
if (IsWhiteSpace(cmdText[i]))
{
index = i;
break;
}
string cmdName;
if (index == 0) // Space after the command specifier should not be supported
{
player.SendErrorMessage("Invalid command entered. Type {0}help for a list of valid commands.", Specifier);
return true;
}
else if (index < 0)
cmdName = cmdText;
else
cmdName = cmdText.Substring(0, index);
string cmdName = args[0].ToLower();
args.RemoveAt(0);
List<string> args;
if (index < 0)
args = new List<string>();
else
args = ParseParameters(cmdText.Substring(index));
IEnumerable<Command> cmds = ChatCommands.FindAll(c => c.HasAlias(cmdName));

View file

@ -1384,7 +1384,13 @@ namespace TShockAPI
{
try
{
args.Handled = Commands.HandleCommand(tsplr, args.Text);
args.Handled = true;
if (!Commands.HandleCommand(tsplr, args.Text))
{
// This is required in case anyone makes HandleCommand return false again
tsplr.SendErrorMessage("Unable to parse command. Please contact an administrator for assistance.");
Log.ConsoleError("Unable to parse command '{0}' from player {1}.", args.Text, tsplr.Name);
}
}
catch (Exception ex)
{