mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Bug fix
This commit is contained in:
parent
77d858dc35
commit
c1a04fe5bf
12 changed files with 57 additions and 27 deletions
|
|
@ -39,7 +39,7 @@ namespace MinecraftClient.ChatBots
|
|||
public bool Attack_Passive = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoAttack.List_Mode$")]
|
||||
public ListType List_Mode = ListType.blacklist;
|
||||
public ListType List_Mode = ListType.whitelist;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoAttack.Entites_List$")]
|
||||
public List<EntityType> Entites_List = new() { EntityType.Zombie, EntityType.Cow };
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MinecraftClient.Inventory;
|
||||
using MinecraftClient.Mapping;
|
||||
using Tomlet.Attributes;
|
||||
|
|
@ -298,8 +299,10 @@ namespace MinecraftClient.ChatBots
|
|||
switch (args[0])
|
||||
{
|
||||
case "list":
|
||||
string names = string.Join(", ", Config.Recipes.ToList());
|
||||
return Translations.Get("bot.autoCraft.cmd.list", Config.Recipes.Length, names);
|
||||
StringBuilder nameList = new();
|
||||
foreach (RecipeConfig recipe in Config.Recipes)
|
||||
nameList.Append(recipe.Name).Append(", ");
|
||||
return Translations.Get("bot.autoCraft.cmd.list", Config.Recipes.Length, nameList.ToString());
|
||||
case "start":
|
||||
if (args.Length >= 2)
|
||||
{
|
||||
|
|
@ -435,7 +438,7 @@ namespace MinecraftClient.ChatBots
|
|||
Dictionary<int, ItemType> materials = new();
|
||||
for (int i = 0; i < recipeConfig.Slots.Length; ++i)
|
||||
if (recipeConfig.Slots[i] != ItemType.Null)
|
||||
materials[i] = recipeConfig.Slots[i];
|
||||
materials[i + 1] = recipeConfig.Slots[i];
|
||||
|
||||
ItemType ResultItem = recipeConfig.Result;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace MinecraftClient.ChatBots
|
|||
public string[] Kick_Messages = new string[] { "Connection has been lost", "Server is restarting", "Server is full", "Too Many people" };
|
||||
|
||||
[NonSerialized]
|
||||
public int _DelayMin, _DelayMax;
|
||||
public static int _BotRecoAttempts = 0;
|
||||
|
||||
public void OnSettingUpdate()
|
||||
{
|
||||
|
|
@ -43,9 +43,6 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
if (Delay.min > Delay.max)
|
||||
(Delay.min, Delay.max) = (Delay.max, Delay.min);
|
||||
|
||||
_DelayMin = (int)Math.Round(Delay.min * 10);
|
||||
_DelayMax = (int)Math.Round(Delay.max * 10);
|
||||
|
||||
if (Retries == -1)
|
||||
Retries = int.MaxValue;
|
||||
|
|
@ -100,7 +97,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
LogDebugToConsoleTranslated("bot.autoRelog.ignore_user_logout");
|
||||
}
|
||||
else
|
||||
else if (Config.Retries < 0 || Configs._BotRecoAttempts < Config.Retries)
|
||||
{
|
||||
message = GetVerbatim(message);
|
||||
string comp = message.ToLower();
|
||||
|
|
@ -109,6 +106,7 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
if (Config.Ignore_Kick_Message)
|
||||
{
|
||||
Configs._BotRecoAttempts++;
|
||||
LaunchDelayedReconnection(null);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -117,6 +115,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
if (comp.Contains(msg))
|
||||
{
|
||||
Configs._BotRecoAttempts++;
|
||||
LaunchDelayedReconnection(msg);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -130,7 +129,7 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
private void LaunchDelayedReconnection(string? msg)
|
||||
{
|
||||
int delay = random.Next(Config._DelayMin, Config._DelayMax);
|
||||
int delay = random.Next((int)Config.Delay.min, (int)Config.Delay.max);
|
||||
LogDebugToConsoleTranslated(String.IsNullOrEmpty(msg) ? "bot.autoRelog.reconnect_always" : "bot.autoRelog.reconnect", msg);
|
||||
LogToConsoleTranslated("bot.autoRelog.wait", delay);
|
||||
System.Threading.Thread.Sleep(delay * 1000);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
using MinecraftClient.Mapping;
|
||||
using MinecraftClient.Protocol.Handlers;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue