Add additional error messages on login failures

See #976
This commit is contained in:
ORelio 2020-04-30 17:37:57 +02:00
parent 770a82e2d2
commit 116efc5e78
6 changed files with 28 additions and 7 deletions

View file

@ -9,7 +9,7 @@ assignees: ''
**Prerequisites**
- [ ] I made sure I am running the latest [development build](https://ci.appveyor.com/project/ORelio/minecraft-console-client/build/artifacts)
- [ ] I tried to [look for similar issues](https://github.com/ORelio/Minecraft-Console-Client/issues?q=is%3Aissue) before opening an new one
- [ ] I tried to [look for similar issues](https://github.com/ORelio/Minecraft-Console-Client/issues?q=is%3Aissue) before opening a new one
- [ ] I have set `debugmessages=true` in config to diagnose my issue
- [ ] I have redacted session tokens and passwords before attaching screenshots

View file

@ -10,7 +10,7 @@ assignees: ''
**Prerequisites**
- [ ] I have read and understood the [user manual](https://github.com/ORelio/Minecraft-Console-Client/tree/master/MinecraftClient/config)
- [ ] I made sure I am running the latest [development build](https://ci.appveyor.com/project/ORelio/minecraft-console-client/build/artifacts)
- [ ] I tried to [look for similar feature requests](https://github.com/ORelio/Minecraft-Console-Client/issues?q=is%3Aissue) before opening an new one
- [ ] I tried to [look for similar feature requests](https://github.com/ORelio/Minecraft-Console-Client/issues?q=is%3Aissue) before opening a new one
**Feature description**
A feature request should contain the following items:

View file

@ -10,7 +10,7 @@ assignees: ''
**Prerequisites**
- [ ] I have read and understood the [user manual](https://github.com/ORelio/Minecraft-Console-Client/tree/master/MinecraftClient/config)
- [ ] I made sure I am running the latest [development build](https://ci.appveyor.com/project/ORelio/minecraft-console-client/build/artifacts)
- [ ] I tried to [look for similar questions](https://github.com/ORelio/Minecraft-Console-Client/issues?q=is%3Aissue) before creating an new one
- [ ] I tried to [look for similar questions](https://github.com/ORelio/Minecraft-Console-Client/issues?q=is%3Aissue) before creating a new one
**Description of the Questions**
Your question may contain the following items:

View file

@ -213,10 +213,15 @@ namespace MinecraftClient
timeoutdetector.Start();
}
}
else
{
Console.WriteLine("Failed to login to this server.");
retry = true;
}
}
catch (Exception e)
{
ConsoleIO.WriteLineFormatted("§8" + e.Message);
ConsoleIO.WriteLineFormatted("§8" + e.GetType().Name + ": " + e.Message);
Console.WriteLine("Failed to join this server.");
retry = true;
}

View file

@ -470,7 +470,11 @@ namespace MinecraftClient.Protocol.Handlers
return StartEncryption(uuid, username, sessionID, token, serverID, PublicServerkey);
}
else return false;
else
{
ConsoleIO.WriteLineFormatted("§8Invalid response to Handshake packet");
return false;
}
}
private bool StartEncryption(string uuid, string username, string sessionID, byte[] token, string serverIDhash, byte[] serverKey)
@ -486,6 +490,7 @@ namespace MinecraftClient.Protocol.Handlers
Console.WriteLine("Checking Session...");
if (!ProtocolHandler.SessionCheck(uuid, sessionID, CryptoHandler.getServerHash(serverIDhash, serverKey, secretKey)))
{
handler.OnConnectionLost(ChatBot.DisconnectReason.LoginRejected, "Failed to check session.");
return false;
}
}
@ -520,7 +525,11 @@ namespace MinecraftClient.Protocol.Handlers
encrypted = true;
return true;
}
else return false;
else
{
ConsoleIO.WriteLineFormatted("§8Invalid response to StartEncryption packet");
return false;
}
}
public bool Login()
@ -555,9 +564,10 @@ namespace MinecraftClient.Protocol.Handlers
}
}
}
catch
catch (Exception e)
{
//Connection failed
ConsoleIO.WriteLineFormatted("§8" + e.GetType().Name + ": " + e.Message);
return false;
}
}

View file

@ -863,7 +863,10 @@ namespace MinecraftClient.Protocol.Handlers
login_phase = false;
if (!pForge.CompleteForgeHandshake())
{
ConsoleIO.WriteLineFormatted("§8Forge Login Handshake did not complete successfully");
return false;
}
StartUpdating();
return true; //No need to check session or start encryption
@ -920,7 +923,10 @@ namespace MinecraftClient.Protocol.Handlers
login_phase = false;
if (!pForge.CompleteForgeHandshake())
{
ConsoleIO.WriteLineFormatted("§8Forge StartEncryption Handshake did not complete successfully");
return false;
}
StartUpdating();
return true;