commit
0ec49ab593
2 changed files with 31 additions and 6 deletions
|
|
@ -628,12 +628,31 @@ namespace TShockAPI
|
||||||
if (cmdPrefix == SilentSpecifier)
|
if (cmdPrefix == SilentSpecifier)
|
||||||
silent = true;
|
silent = true;
|
||||||
|
|
||||||
var args = ParseParameters(cmdText);
|
int index = -1;
|
||||||
if (args.Count < 1)
|
for (int i = 0; i < cmdText.Length; i++)
|
||||||
return false;
|
{
|
||||||
|
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.ToLower();
|
||||||
|
else
|
||||||
|
cmdName = cmdText.Substring(0, index).ToLower();
|
||||||
|
|
||||||
string cmdName = args[0].ToLower();
|
List<string> args;
|
||||||
args.RemoveAt(0);
|
if (index < 0)
|
||||||
|
args = new List<string>();
|
||||||
|
else
|
||||||
|
args = ParseParameters(cmdText.Substring(index));
|
||||||
|
|
||||||
IEnumerable<Command> cmds = ChatCommands.FindAll(c => c.HasAlias(cmdName));
|
IEnumerable<Command> cmds = ChatCommands.FindAll(c => c.HasAlias(cmdName));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1384,7 +1384,13 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
try
|
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)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue