Handle all internal MCC commands in one place

- MCC internal commands for command prompt, remote control and scripts
are handled in one place, thus it's no more needed to add them in 3
different places.
- "exit" command in scripts is not equivalent to "/quit"
- removed "disconnect" command in scripts /!\
- bots can now easily perform internal MCC commands.
This commit is contained in:
ORelio 2014-06-14 13:20:15 +02:00
parent 283074bb63
commit 9456e82923
4 changed files with 144 additions and 86 deletions

View file

@ -20,27 +20,6 @@ namespace MinecraftClient.ChatBots
string cmd_name = command.Split(' ')[0];
switch (cmd_name.ToLower())
{
case "exit":
DisconnectAndExit();
break;
case "reco":
ReconnectToTheServer();
break;
case "script":
if (command.Length >= 8)
RunScript(command.Substring(7), sender);
break;
case "send":
if (command.Length >= 6)
SendText(command.Substring(5));
break;
case "connect":
if (command.Length >= 9)
{
Settings.setServerIP(command.Substring(8));
ReconnectToTheServer();
}
break;
case "help":
if (command.Length >= 6)
{
@ -59,7 +38,11 @@ namespace MinecraftClient.ChatBots
else SendPrivateMessage(sender, "help <cmdname>. Available commands: exit, reco, script, send, connect.");
break;
default:
SendPrivateMessage(sender, "Unknown command '" + cmd_name + "'. Use 'help' for help.");
if (isInternalCommand(command))
{
performInternalCommand(command);
}
else SendPrivateMessage(sender, "Unknown command '" + cmd_name + "'. Use 'help' for help.");
break;
}
}