mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
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:
parent
283074bb63
commit
9456e82923
4 changed files with 144 additions and 86 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue