mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
GUI API for tab-complete
Allow the GUI to pass a request to the console client, not to the server. Any string starting with a null character is handled by the console: Command is: \0commandname\0commandarg Output from console: \0commandname\0result eg. \0autocomplete\0/he -> \0autocomplete\0/help Currently, only "autocomplete" command is implemented.
This commit is contained in:
parent
29ea512dbb
commit
84b8b9da2a
1 changed files with 37 additions and 22 deletions
|
|
@ -157,6 +157,20 @@ namespace MinecraftClient
|
||||||
while (client.Client.Connected)
|
while (client.Client.Connected)
|
||||||
{
|
{
|
||||||
text = ConsoleIO.ReadLine();
|
text = ConsoleIO.ReadLine();
|
||||||
|
if (ConsoleIO.basicIO && text.Length > 0 && text[0] == (char)0x00)
|
||||||
|
{
|
||||||
|
//Process a request from the GUI
|
||||||
|
string[] command = text.Substring(1).Split((char)0x00);
|
||||||
|
switch (command[0].ToLower())
|
||||||
|
{
|
||||||
|
case "autocomplete":
|
||||||
|
if (command.Length > 1) { ConsoleIO.WriteLine((char)0x00 + "autocomplete" + (char)0x00 + handler.AutoComplete(command[1])); }
|
||||||
|
else Console.WriteLine((char)0x00 + "autocomplete" + (char)0x00);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (text == "/quit" || text == "/reco" || text == "/reconnect") { break; }
|
if (text == "/quit" || text == "/reco" || text == "/reconnect") { break; }
|
||||||
while (text.Length > 0 && text[0] == ' ') { text = text.Substring(1); }
|
while (text.Length > 0 && text[0] == ' ') { text = text.Substring(1); }
|
||||||
if (text != "")
|
if (text != "")
|
||||||
|
|
@ -184,6 +198,7 @@ namespace MinecraftClient
|
||||||
else handler.SendChatMessage(text);
|
else handler.SendChatMessage(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (text == "/quit")
|
if (text == "/quit")
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue