Reamls worlds: Use expired property to determine available world

This commit is contained in:
ReinforceZwei 2021-05-17 16:53:38 +08:00
parent 83521d7cca
commit 8efb8d80a4

View file

@ -700,20 +700,16 @@ namespace MinecraftClient.Protocol
if (realmsServer.Properties.ContainsKey("name") if (realmsServer.Properties.ContainsKey("name")
&& realmsServer.Properties.ContainsKey("owner") && realmsServer.Properties.ContainsKey("owner")
&& realmsServer.Properties.ContainsKey("id") && realmsServer.Properties.ContainsKey("id")
&& realmsServer.Properties.ContainsKey("daysLeft")) && realmsServer.Properties.ContainsKey("expired"))
{ {
int daysLeft; if (realmsServer.Properties["expired"].StringValue == "false")
if (int.TryParse(realmsServer.Properties["daysLeft"].StringValue, out daysLeft))
{ {
if (daysLeft > 0) availableWorlds.Add(String.Format("[{0}] {2} ({3}) - {1}",
{ index++,
availableWorlds.Add(String.Format("[{0}] {2} ({3}) - {1}", realmsServer.Properties["id"].StringValue,
index++, realmsServer.Properties["name"].StringValue,
realmsServer.Properties["id"].StringValue, realmsServer.Properties["owner"].StringValue));
realmsServer.Properties["name"].StringValue, realmsWorldsResult.Add(realmsServer.Properties["id"].StringValue);
realmsServer.Properties["owner"].StringValue));
realmsWorldsResult.Add(realmsServer.Properties["id"].StringValue);
}
} }
} }
} }