Handle the case where "name" exists twice in the result string, like when connecting to a server with another user logged in.

This commit is contained in:
Corban Mailloux 2014-10-24 09:30:10 -04:00
parent 1c28270377
commit fef50a3d48

View file

@ -544,7 +544,9 @@ namespace MinecraftClient.Protocol.Handlers
if (tmp_ver.Length >= 2 && tmp_name.Length >= 2) if (tmp_ver.Length >= 2 && tmp_name.Length >= 2)
{ {
protocolversion = atoi(tmp_ver[1]); protocolversion = atoi(tmp_ver[1]);
version = tmp_name[1].Split('"')[0];
// Handle if "name" exists twice, like when connecting to a server with another user logged in.
version = (tmp_name.Length == 2) ? tmp_name[1].Split('"')[0] : tmp_name[2].Split('"')[0];
if (result.Contains("modinfo\":")) if (result.Contains("modinfo\":"))
{ {
//Server is running Forge (which is not supported) //Server is running Forge (which is not supported)