Add OnSettingsReload

This commit is contained in:
BruceChen 2022-09-13 19:29:17 +08:00
parent fc444fcbd6
commit 97248aad16

View file

@ -47,14 +47,36 @@ namespace MinecraftClient.ChatBots
if (!GetEntityHandlingEnabled()) if (!GetEntityHandlingEnabled())
{ {
LogToConsoleTranslated("extra.entity_required"); LogToConsoleTranslated("extra.entity_required");
LogToConsoleTranslated("general.bot_unload"); state = FishingState.WaitJoinGame;
UnloadBot();
} }
inventoryEnabled = GetInventoryEnabled(); inventoryEnabled = GetInventoryEnabled();
if (!inventoryEnabled) if (!inventoryEnabled)
LogToConsoleTranslated("bot.autoFish.no_inv_handle"); LogToConsoleTranslated("bot.autoFish.no_inv_handle");
} }
/// <summary>
/// Update settings when reloaded
/// </summary>
public /* override */ void OnSettingsReload()
{
if (Settings.AutoFishing_Enabled)
{
if (!GetEntityHandlingEnabled())
{
LogToConsoleTranslated("extra.entity_required");
state = FishingState.WaitJoinGame;
}
inventoryEnabled = GetInventoryEnabled();
if (!inventoryEnabled)
LogToConsoleTranslated("bot.autoFish.no_inv_handle");
}
else
{
UnloadBot();
return;
}
}
private void StartFishing() private void StartFishing()
{ {
isFishing = false; isFishing = false;