mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Realms: Allow direct server ID, handle invalid ID (#1533)
This commit is contained in:
parent
8efb8d80a4
commit
9af9fe78ee
4 changed files with 21 additions and 8 deletions
|
|
@ -256,18 +256,28 @@ namespace MinecraftClient
|
|||
HandleFailure(Translations.Get("error.realms.access_denied"), false, ChatBot.DisconnectReason.LoginRejected);
|
||||
return;
|
||||
}
|
||||
int worldIndex = Convert.ToUInt16(addressInput.Split(':')[1]);
|
||||
string worldId = availableWorlds[worldIndex];
|
||||
string RealmsAddress = ProtocolHandler.GetRealmsWorldServerAddress(worldId, Settings.Username, session.PlayerID, session.ID);
|
||||
if (RealmsAddress != "")
|
||||
int worldIndex = 0;
|
||||
string worldId = addressInput.Split(':')[1];
|
||||
if (!availableWorlds.Contains(worldId) && int.TryParse(worldId, out worldIndex) && worldIndex < availableWorlds.Count)
|
||||
worldId = availableWorlds[worldIndex];
|
||||
if (availableWorlds.Contains(worldId))
|
||||
{
|
||||
addressInput = RealmsAddress;
|
||||
isRealms = true;
|
||||
Settings.ServerVersion = MCHighestVersion;
|
||||
string RealmsAddress = ProtocolHandler.GetRealmsWorldServerAddress(worldId, Settings.Username, session.PlayerID, session.ID);
|
||||
if (RealmsAddress != "")
|
||||
{
|
||||
addressInput = RealmsAddress;
|
||||
isRealms = true;
|
||||
Settings.ServerVersion = MCHighestVersion;
|
||||
}
|
||||
else
|
||||
{
|
||||
HandleFailure(Translations.Get("error.realms.server_unavailable"), false, ChatBot.DisconnectReason.LoginRejected);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HandleFailure(Translations.Get("error.realms.server_unavailable"), false, ChatBot.DisconnectReason.LoginRejected);
|
||||
HandleFailure(Translations.Get("error.realms.server_id"), false, ChatBot.DisconnectReason.LoginRejected);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue