diff --git a/MinecraftClient/ChatBots/AutoCarft.cs b/MinecraftClient/ChatBots/AutoCarft.cs index 3f5e4c21..ca795efe 100644 --- a/MinecraftClient/ChatBots/AutoCarft.cs +++ b/MinecraftClient/ChatBots/AutoCarft.cs @@ -158,7 +158,13 @@ namespace MinecraftClient.ChatBots public override void Initialize() { + if (!GetInventoryEnabled()) + { + ConsoleIO.WriteLogLine("Inventory handling is disabled. AutoCraft will be unloaded"); + UnloadBot(); + } RegisterChatBotCommand("autocraft", "auto craft", CommandHandler); + LoadConfig(); } public string CommandHandler(string cmd, string[] args) @@ -244,16 +250,16 @@ namespace MinecraftClient.ChatBots Directory.CreateDirectory(@"autocraft"); } WriteDefaultConfig(); - ConsoleIO.WriteLogLine("No config found. Writing a new one."); + ConsoleIO.WriteLogLine("[AutoCraft] No config found. Writing a new one."); } try { ParseConfig(); - ConsoleIO.WriteLogLine("Successfully loaded"); + ConsoleIO.WriteLogLine("[AutoCraft] Successfully loaded"); } catch (Exception e) { - ConsoleIO.WriteLogLine("Error while parsing config: \n" + e.Message); + ConsoleIO.WriteLogLine("[AutoCraft] Error while parsing config: \n" + e.Message); } } diff --git a/MinecraftClient/McClient.cs b/MinecraftClient/McClient.cs index 7ab24d97..1ef9053a 100644 --- a/MinecraftClient/McClient.cs +++ b/MinecraftClient/McClient.cs @@ -175,8 +175,7 @@ namespace MinecraftClient if (Settings.AutoAttack_Enabled) { BotLoad(new ChatBots.AutoAttack()); } if (Settings.AutoFishing_Enabled) { BotLoad(new ChatBots.AutoFishing()); } if (Settings.AutoEat_Enabled) { BotLoad(new ChatBots.AutoEat(Settings.AutoEat_hungerThreshold)); } - - BotLoad(new AutoCarft()); + if (Settings.AutoCraft_Enabled) { BotLoad(new AutoCarft()); } //Add your ChatBot here by uncommenting and adapting //BotLoad(new ChatBots.YourBot()); diff --git a/MinecraftClient/Settings.cs b/MinecraftClient/Settings.cs index f2c624f5..63a55e9f 100644 --- a/MinecraftClient/Settings.cs +++ b/MinecraftClient/Settings.cs @@ -164,12 +164,15 @@ namespace MinecraftClient public static bool AutoEat_Enabled = false; public static int AutoEat_hungerThreshold = 6; + //AutoCraft + public static bool AutoCraft_Enabled = false; + //Custom app variables and Minecraft accounts private static readonly Dictionary AppVars = new Dictionary(); private static readonly Dictionary> Accounts = new Dictionary>(); private static readonly Dictionary> Servers = new Dictionary>(); - private enum ParseMode { Default, Main, AppVars, Proxy, MCSettings, AntiAFK, Hangman, Alerts, ChatLog, AutoRelog, ScriptScheduler, RemoteControl, ChatFormat, AutoRespond, AutoAttack, AutoFishing, AutoEat }; + private enum ParseMode { Default, Main, AppVars, Proxy, MCSettings, AntiAFK, Hangman, Alerts, ChatLog, AutoRelog, ScriptScheduler, RemoteControl, ChatFormat, AutoRespond, AutoAttack, AutoFishing, AutoEat, AutoCraft }; /// /// Load settings from the give INI file @@ -213,6 +216,7 @@ namespace MinecraftClient case "autoattack": pMode = ParseMode.AutoAttack; break; case "autofishing": pMode = ParseMode.AutoFishing; break; case "autoeat": pMode = ParseMode.AutoEat; break; + case "autocraft": pMode = ParseMode.AutoCraft; break; default: pMode = ParseMode.Default; break; } } @@ -492,6 +496,13 @@ namespace MinecraftClient } break; + case ParseMode.AutoCraft: + switch (argName.ToLower()) + { + case "enabled": AutoCraft_Enabled = str2bool(argValue); break; + } + break; + case ParseMode.MCSettings: switch (argName.ToLower()) { @@ -700,6 +711,11 @@ namespace MinecraftClient + "# Inventory Handling NEED to be enabled first\r\n" + "enabled=false\r\n" + "threshold=6\r\n" + + "\r\n" + + "[AutoCraft]" + + "# Inventory Handling NEED to be enabled first\r\n" + + "# Enable terrainandmovements if you need to use crafting table\r\n" + + "enabled=false\r\n" + "\r\n", Encoding.UTF8); }