From a4816403062c1d04f67c08dc295a623489d38a11 Mon Sep 17 00:00:00 2001 From: ORelio Date: Wed, 2 Apr 2014 22:53:46 +0200 Subject: [PATCH] Remove legacy command-line args & xauth bot - Use scripting instead of xauth bot - Use ini files instead of bot:botname args --- MinecraftClient/Bots.cs | 25 ----------- MinecraftClient/Program.cs | 86 ------------------------------------- MinecraftClient/Settings.cs | 4 -- 3 files changed, 115 deletions(-) diff --git a/MinecraftClient/Bots.cs b/MinecraftClient/Bots.cs index 4da3f296..dfd1ecc4 100644 --- a/MinecraftClient/Bots.cs +++ b/MinecraftClient/Bots.cs @@ -830,31 +830,6 @@ namespace MinecraftClient } } - /// - /// Automatically send login command on servers usign the xAuth plugin - /// - - public class xAuth : ChatBot - { - private string password; - private int countdown = 50; - - public xAuth(string pass) - { - password = pass; - } - - public override void Update() - { - countdown--; - if (countdown == 0) - { - SendText("/login " + password); - UnloadBot(); //This bot is no more needed. - } - } - } - /// /// Runs a list of commands /// Usage: bot:scripting:filename diff --git a/MinecraftClient/Program.cs b/MinecraftClient/Program.cs index a35c7236..e887b96c 100644 --- a/MinecraftClient/Program.cs +++ b/MinecraftClient/Program.cs @@ -65,91 +65,6 @@ namespace MinecraftClient { Settings.SingleCommand = args[3]; } - - //Use bots? (will disable single command) - for (int i = 3; i < args.Length; i++) - { - if (args[i].Length > 4 && args[i].Substring(0, 4).ToLower() == "bot:") - { - Settings.SingleCommand = ""; - string[] botargs = args[i].ToLower().Split(':'); - switch (botargs[1]) - { - #region Process bots settings - case "antiafk": - Settings.AntiAFK_Enabled = true; - if (botargs.Length > 2) - { - try { Settings.AntiAFK_Delay = Convert.ToInt32(botargs[2]); } - catch (FormatException) { } - } break; - - case "pendu": - Settings.Hangman_Enabled = true; - Settings.Hangman_English = false; - break; - - case "hangman": - Settings.Hangman_Enabled = true; - Settings.Hangman_English = true; - break; - - case "alerts": - Settings.Alerts_Enabled = true; - break; - - case "log": - Settings.ChatLog_Enabled = true; - Settings.ChatLog_DateTime = true; - Settings.ChatLog_File = "chat-" + Settings.ServerIP.Replace(':', '-') + ".log"; - if (botargs.Length > 2) - { - Settings.ChatLog_DateTime = Settings.str2bool(botargs[2]); - if (botargs.Length > 3) - { - Settings.ChatLog_Filter = Bots.ChatLog.str2filter(botargs[3]); - if (botargs.Length > 4 && botargs[4] != "") { Settings.ChatLog_File = botargs[4]; } - } - } break; - - case "logplayerlist": - Settings.PlayerLog_File = "connected-" + Settings.ServerIP.Replace(':', '-') + ".log"; - if (botargs.Length > 2) - { - try { Settings.PlayerLog_Delay = Convert.ToInt32(botargs[2]); } - catch (FormatException) { } - } break; - - case "autorelog": - if (botargs.Length > 2) - { - try { Settings.AutoRelog_Delay = Convert.ToInt32(botargs[2]); } - catch (FormatException) { } - if (botargs.Length > 3) - { - try { Settings.AutoRelog_Retries = Convert.ToInt32(botargs[3]); } - catch (FormatException) { } - } - } break; - - case "xauth": - if (botargs.Length > 2) - { - Settings.xAuth_Enabled = true; - Settings.xAuth_Password = botargs[2]; - } break; - - case "scripting": - if (botargs.Length > 2) - { - Settings.Scripting_Enabled = true; - Settings.Scripting_ScriptFile = botargs[2]; - } break; - - #endregion - } - } - } } } } @@ -247,7 +162,6 @@ namespace MinecraftClient if (Settings.ChatLog_Enabled) { handler.BotLoad(new Bots.ChatLog(Settings.ChatLog_File, Settings.ChatLog_Filter, Settings.ChatLog_DateTime)); } if (Settings.PlayerLog_Enabled) { handler.BotLoad(new Bots.PlayerListLogger(Settings.PlayerLog_Delay, Settings.PlayerLog_File)); } if (Settings.AutoRelog_Enabled) { handler.BotLoad(new Bots.AutoRelog(Settings.AutoRelog_Delay, Settings.AutoRelog_Retries)); } - if (Settings.xAuth_Enabled) { handler.BotLoad(new Bots.xAuth(Settings.xAuth_Password)); } if (Settings.Scripting_Enabled) { handler.BotLoad(new Bots.Scripting(Settings.Scripting_ScriptFile)); } //Start the main TCP client diff --git a/MinecraftClient/Settings.cs b/MinecraftClient/Settings.cs index 6c82bc09..126075ab 100644 --- a/MinecraftClient/Settings.cs +++ b/MinecraftClient/Settings.cs @@ -63,10 +63,6 @@ namespace MinecraftClient public static int AutoRelog_Retries = 3; public static string AutoRelog_KickMessagesFile = "kickmessages.txt"; - //xAuth Settings - public static bool xAuth_Enabled = false; - public static string xAuth_Password = ""; - //Scripting Settings public static bool Scripting_Enabled = false; public static string Scripting_ScriptFile = "script.txt";