Allow Forge detection with manual MC version (#1004)

This commit is contained in:
ORelio 2020-05-24 19:53:31 +02:00
parent 3996f72d23
commit b2bcfca8ec
3 changed files with 13 additions and 3 deletions

View file

@ -245,9 +245,11 @@ namespace MinecraftClient
} }
} }
if (protocolversion == 0) if (protocolversion == 0 || Settings.ServerMayHaveForge)
{ {
Console.WriteLine("Retrieving Server Info..."); if (protocolversion != 0)
Console.WriteLine("Checking if server is running Forge...");
else Console.WriteLine("Retrieving Server Info...");
if (!ProtocolHandler.GetServerInfo(Settings.ServerIP, Settings.ServerPort, ref protocolversion, ref forgeInfo)) if (!ProtocolHandler.GetServerInfo(Settings.ServerIP, Settings.ServerPort, ref protocolversion, ref forgeInfo))
{ {
HandleFailure("Failed to ping this IP.", true, ChatBots.AutoRelog.DisconnectReason.ConnectionLost); HandleFailure("Failed to ping this IP.", true, ChatBots.AutoRelog.DisconnectReason.ConnectionLost);

View file

@ -88,6 +88,11 @@ namespace MinecraftClient.Protocol
} }
}, TimeSpan.FromSeconds(Settings.ResolveSrvRecordsShortTimeout ? 10 : 30))) }, TimeSpan.FromSeconds(Settings.ResolveSrvRecordsShortTimeout ? 10 : 30)))
{ {
if (protocolversion != 0 && protocolversion != protocolversionTmp)
ConsoleIO.WriteLineFormatted("§8Server reports a different version than manually set. Login may not work.");
if (protocolversion == 0 && protocolversionTmp == 0)
ConsoleIO.WriteLineFormatted("§8Server does not report its protocol version, autodetection will not work.");
if (protocolversion == 0)
protocolversion = protocolversionTmp; protocolversion = protocolversionTmp;
forgeInfo = forgeInfoTmp; forgeInfo = forgeInfoTmp;
return success; return success;

View file

@ -28,6 +28,7 @@ namespace MinecraftClient
public static string ServerIP = ""; public static string ServerIP = "";
public static ushort ServerPort = 25565; public static ushort ServerPort = 25565;
public static string ServerVersion = ""; public static string ServerVersion = "";
public static bool ServerMayHaveForge = true;
public static string SingleCommand = ""; public static string SingleCommand = "";
public static string ConsoleTitle = ""; public static string ConsoleTitle = "";
@ -237,6 +238,7 @@ namespace MinecraftClient
case "playerheadicon": playerHeadAsIcon = str2bool(argValue); break; case "playerheadicon": playerHeadAsIcon = str2bool(argValue); break;
case "chatbotlogfile": chatbotLogFile = argValue; break; case "chatbotlogfile": chatbotLogFile = argValue; break;
case "mcversion": ServerVersion = argValue; break; case "mcversion": ServerVersion = argValue; break;
case "mcforge": ServerMayHaveForge = argValue.ToLower() == "auto" || str2bool(argValue); break;
case "splitmessagedelay": splitMessageDelay = TimeSpan.FromSeconds(str2int(argValue)); break; case "splitmessagedelay": splitMessageDelay = TimeSpan.FromSeconds(str2int(argValue)); break;
case "scriptcache": CacheScripts = str2bool(argValue); break; case "scriptcache": CacheScripts = str2bool(argValue); break;
case "showsystemmessages": DisplaySystemMessages = str2bool(argValue); break; case "showsystemmessages": DisplaySystemMessages = str2bool(argValue); break;
@ -584,6 +586,7 @@ namespace MinecraftClient
+ "botowners=Player1,Player2,Player3 # Use name list or myfile.txt with one name per line\r\n" + "botowners=Player1,Player2,Player3 # Use name list or myfile.txt with one name per line\r\n"
+ "botmessagedelay=2 # Seconds to delay between message a bot makes to avoid accidental spam\r\n" + "botmessagedelay=2 # Seconds to delay between message a bot makes to avoid accidental spam\r\n"
+ "mcversion=auto # Use 'auto' or '1.X.X' values\r\n" + "mcversion=auto # Use 'auto' or '1.X.X' values\r\n"
+ "mcforge=auto # Use 'auto' or 'false'\r\n"
+ "brandinfo=mcc # Use 'mcc','vanilla', or 'none'\r\n" + "brandinfo=mcc # Use 'mcc','vanilla', or 'none'\r\n"
+ "chatbotlogfile= # Leave empty for no logfile\r\n" + "chatbotlogfile= # Leave empty for no logfile\r\n"
+ "privatemsgscmdname=tell # Used by RemoteControl bot\r\n" + "privatemsgscmdname=tell # Used by RemoteControl bot\r\n"