App refactoring almost done

- Created specific namespaces and folders for each app brick
- Added proxy support using Starksoft's Biko Library
- App bricks: Main, ChatBots, Crypto, Protocol, Proxy
- Each class is now in its own file (Aes streams, chatbots)
- Used "Bridge" design pattern for Crypto, Protocol, Proxy
- Added back support for Minecraft 1.4.6 to 1.6.4 (MCC 1.6.2)
- Need to fully re-test everything and fix bugs
- To Fix : Server pinging is slow on SpigotMC
- To Do : Add Minecraft 1.2.5 (MCC 1.3) and maybe 1.3 to 1.4.5
This commit is contained in:
ORelio 2014-05-31 01:59:03 +02:00
parent 9be1d99ca0
commit d2ec2f48b7
43 changed files with 6039 additions and 2178 deletions

View file

@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MinecraftClient.ChatBots
{
/// <summary>
/// Allow to perform operations using whispers to the bot
/// </summary>
public class RemoteControl : ChatBot
{
public override void GetText(string text)
{
text = getVerbatim(text);
string command = "", sender = "";
if (isPrivateMessage(text, ref command, ref sender) && Settings.Bots_Owners.Contains(sender.ToLower()))
{
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.ServerIP = command.Substring(8);
ReconnectToTheServer();
}
break;
case "help":
if (command.Length >= 6)
{
string help_cmd_name = command.Substring(5).ToLower();
switch (help_cmd_name)
{
case "exit": SendPrivateMessage(sender, "exit: disconnect from the server."); break;
case "reco": SendPrivateMessage(sender, "reco: restart and reconnct to the server."); break;
case "script": SendPrivateMessage(sender, "script <scriptname>: run a script file."); break;
case "send": SendPrivateMessage(sender, "send <text>: send a chat message or command."); break;
case "connect": SendPrivateMessage(sender, "connect <serverip>: connect to the specified server."); break;
case "help": SendPrivateMessage(sender, "help <cmdname>: show brief help about a command."); break;
default: SendPrivateMessage(sender, "help: unknown command '" + help_cmd_name + "'."); break;
}
}
else SendPrivateMessage(sender, "help <cmdname>. Available commands: exit, reco, script, send, connect.");
break;
default:
SendPrivateMessage(sender, "Unknown command '" + cmd_name + "'. Use 'help' for help.");
break;
}
}
}
}
}