mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
parent
8f77895084
commit
474aee3e55
1 changed files with 10 additions and 11 deletions
|
|
@ -396,20 +396,19 @@ namespace MinecraftClient
|
||||||
string result = ComTmp.readNextString(); //Get the Json data
|
string result = ComTmp.readNextString(); //Get the Json data
|
||||||
if (result[0] == '{' && result.Contains("protocol\":") && result.Contains("name\":\""))
|
if (result[0] == '{' && result.Contains("protocol\":") && result.Contains("name\":\""))
|
||||||
{
|
{
|
||||||
string tmp_ver = result.Split(new string[] { "protocol\":" }, StringSplitOptions.None)[1];
|
string[] tmp_ver = result.Split(new string[] { "protocol\":" }, StringSplitOptions.None);
|
||||||
string tmp_name = result.Split(new string[] { "name\":\"" }, StringSplitOptions.None)[1];
|
string[] tmp_name = result.Split(new string[] { "name\":\"" }, StringSplitOptions.None);
|
||||||
|
|
||||||
//Detecting Forge (which is not supported)
|
|
||||||
if (result.Contains("modinfo\":"))
|
|
||||||
{
|
|
||||||
tmp_name += "Forge ";
|
|
||||||
tmp_ver = "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tmp_ver.Length >= 2 && tmp_name.Length >= 2)
|
if (tmp_ver.Length >= 2 && tmp_name.Length >= 2)
|
||||||
{
|
{
|
||||||
protocolversion = atoi(tmp_ver);
|
protocolversion = atoi(tmp_ver[1]);
|
||||||
version = tmp_name.Split('"')[0];
|
version = tmp_name[1].Split('"')[0];
|
||||||
|
if (result.Contains("modinfo\":"))
|
||||||
|
{
|
||||||
|
//Server is running Forge (which is not supported)
|
||||||
|
version = "Forge " + version;
|
||||||
|
protocolversion = 0;
|
||||||
|
}
|
||||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||||
//Console.WriteLine(result); //Debug: show the full Json string
|
//Console.WriteLine(result); //Debug: show the full Json string
|
||||||
Console.WriteLine("Server version : " + version + " (protocol v" + protocolversion + ").");
|
Console.WriteLine("Server version : " + version + " (protocol v" + protocolversion + ").");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue