mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Add config setting for AutoCraft
This commit is contained in:
parent
d71fb88d93
commit
6967f6928b
3 changed files with 27 additions and 6 deletions
|
|
@ -158,7 +158,13 @@ namespace MinecraftClient.ChatBots
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
if (!GetInventoryEnabled())
|
||||||
|
{
|
||||||
|
ConsoleIO.WriteLogLine("Inventory handling is disabled. AutoCraft will be unloaded");
|
||||||
|
UnloadBot();
|
||||||
|
}
|
||||||
RegisterChatBotCommand("autocraft", "auto craft", CommandHandler);
|
RegisterChatBotCommand("autocraft", "auto craft", CommandHandler);
|
||||||
|
LoadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CommandHandler(string cmd, string[] args)
|
public string CommandHandler(string cmd, string[] args)
|
||||||
|
|
@ -244,16 +250,16 @@ namespace MinecraftClient.ChatBots
|
||||||
Directory.CreateDirectory(@"autocraft");
|
Directory.CreateDirectory(@"autocraft");
|
||||||
}
|
}
|
||||||
WriteDefaultConfig();
|
WriteDefaultConfig();
|
||||||
ConsoleIO.WriteLogLine("No config found. Writing a new one.");
|
ConsoleIO.WriteLogLine("[AutoCraft] No config found. Writing a new one.");
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ParseConfig();
|
ParseConfig();
|
||||||
ConsoleIO.WriteLogLine("Successfully loaded");
|
ConsoleIO.WriteLogLine("[AutoCraft] Successfully loaded");
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
ConsoleIO.WriteLogLine("Error while parsing config: \n" + e.Message);
|
ConsoleIO.WriteLogLine("[AutoCraft] Error while parsing config: \n" + e.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -175,8 +175,7 @@ namespace MinecraftClient
|
||||||
if (Settings.AutoAttack_Enabled) { BotLoad(new ChatBots.AutoAttack()); }
|
if (Settings.AutoAttack_Enabled) { BotLoad(new ChatBots.AutoAttack()); }
|
||||||
if (Settings.AutoFishing_Enabled) { BotLoad(new ChatBots.AutoFishing()); }
|
if (Settings.AutoFishing_Enabled) { BotLoad(new ChatBots.AutoFishing()); }
|
||||||
if (Settings.AutoEat_Enabled) { BotLoad(new ChatBots.AutoEat(Settings.AutoEat_hungerThreshold)); }
|
if (Settings.AutoEat_Enabled) { BotLoad(new ChatBots.AutoEat(Settings.AutoEat_hungerThreshold)); }
|
||||||
|
if (Settings.AutoCraft_Enabled) { BotLoad(new AutoCarft()); }
|
||||||
BotLoad(new AutoCarft());
|
|
||||||
|
|
||||||
//Add your ChatBot here by uncommenting and adapting
|
//Add your ChatBot here by uncommenting and adapting
|
||||||
//BotLoad(new ChatBots.YourBot());
|
//BotLoad(new ChatBots.YourBot());
|
||||||
|
|
|
||||||
|
|
@ -164,12 +164,15 @@ namespace MinecraftClient
|
||||||
public static bool AutoEat_Enabled = false;
|
public static bool AutoEat_Enabled = false;
|
||||||
public static int AutoEat_hungerThreshold = 6;
|
public static int AutoEat_hungerThreshold = 6;
|
||||||
|
|
||||||
|
//AutoCraft
|
||||||
|
public static bool AutoCraft_Enabled = false;
|
||||||
|
|
||||||
//Custom app variables and Minecraft accounts
|
//Custom app variables and Minecraft accounts
|
||||||
private static readonly Dictionary<string, object> AppVars = new Dictionary<string, object>();
|
private static readonly Dictionary<string, object> AppVars = new Dictionary<string, object>();
|
||||||
private static readonly Dictionary<string, KeyValuePair<string, string>> Accounts = new Dictionary<string, KeyValuePair<string, string>>();
|
private static readonly Dictionary<string, KeyValuePair<string, string>> Accounts = new Dictionary<string, KeyValuePair<string, string>>();
|
||||||
private static readonly Dictionary<string, KeyValuePair<string, ushort>> Servers = new Dictionary<string, KeyValuePair<string, ushort>>();
|
private static readonly Dictionary<string, KeyValuePair<string, ushort>> Servers = new Dictionary<string, KeyValuePair<string, ushort>>();
|
||||||
|
|
||||||
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 };
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load settings from the give INI file
|
/// Load settings from the give INI file
|
||||||
|
|
@ -213,6 +216,7 @@ namespace MinecraftClient
|
||||||
case "autoattack": pMode = ParseMode.AutoAttack; break;
|
case "autoattack": pMode = ParseMode.AutoAttack; break;
|
||||||
case "autofishing": pMode = ParseMode.AutoFishing; break;
|
case "autofishing": pMode = ParseMode.AutoFishing; break;
|
||||||
case "autoeat": pMode = ParseMode.AutoEat; break;
|
case "autoeat": pMode = ParseMode.AutoEat; break;
|
||||||
|
case "autocraft": pMode = ParseMode.AutoCraft; break;
|
||||||
default: pMode = ParseMode.Default; break;
|
default: pMode = ParseMode.Default; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -492,6 +496,13 @@ namespace MinecraftClient
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ParseMode.AutoCraft:
|
||||||
|
switch (argName.ToLower())
|
||||||
|
{
|
||||||
|
case "enabled": AutoCraft_Enabled = str2bool(argValue); break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case ParseMode.MCSettings:
|
case ParseMode.MCSettings:
|
||||||
switch (argName.ToLower())
|
switch (argName.ToLower())
|
||||||
{
|
{
|
||||||
|
|
@ -700,6 +711,11 @@ namespace MinecraftClient
|
||||||
+ "# Inventory Handling NEED to be enabled first\r\n"
|
+ "# Inventory Handling NEED to be enabled first\r\n"
|
||||||
+ "enabled=false\r\n"
|
+ "enabled=false\r\n"
|
||||||
+ "threshold=6\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);
|
+ "\r\n", Encoding.UTF8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue