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

@ -90,9 +90,6 @@ namespace MinecraftClient.ChatBots
string instruction_name = instruction_line.Split(' ')[0];
switch (instruction_name.ToLower())
{
case "send":
SendText(instruction_line.Substring(5, instruction_line.Length - 5));
break;
case "wait":
int ticks = 10;
try
@ -102,21 +99,12 @@ namespace MinecraftClient.ChatBots
catch { }
sleepticks = ticks;
break;
case "disconnect":
DisconnectAndExit();
break;
case "exit": //Exit bot & stay connected to the server
UnloadBot();
break;
case "connect":
if (instruction_line.Length >= 9)
{
Settings.setServerIP(instruction_line.Substring(8));
ReconnectToTheServer();
}
break;
default:
sleepticks = 0; Update(); //Unknown command : process next line immediately
if (isInternalCommand(instruction_line))
{
performInternalCommand(instruction_line);
}
else sleepticks = 0; Update(); //Unknown command : process next line immediately
break;
}
}