Variable engine done, catch bot exceptions

- %variable% variables can be declared in the INI file and used
elsewhere
- Default argument 'true' for WriteLineFormatted in ConsoleIO
- Exceptions thrown by bots no longer disconnect from the server, stack
trace is printed instead
This commit is contained in:
ORelio 2014-06-11 20:40:25 +02:00
parent 898a04a843
commit 068b87a11a
10 changed files with 111 additions and 30 deletions

View file

@ -128,7 +128,7 @@ namespace MinecraftClient.Protocol.Handlers
&& System.IO.File.Exists(Settings.TranslationsFile_FromMCDir))
{
Language_File = Settings.TranslationsFile_FromMCDir;
ConsoleIO.WriteLineFormatted("§8Defaulting to en_GB.lang from your Minecraft directory.", false);
ConsoleIO.WriteLineFormatted("§8Defaulting to en_GB.lang from your Minecraft directory.");
}
//Load the external dictionnary of translation rules or display an error message
@ -147,12 +147,12 @@ namespace MinecraftClient.Protocol.Handlers
}
}
ConsoleIO.WriteLineFormatted("§8Translations file loaded.", false);
ConsoleIO.WriteLineFormatted("§8Translations file loaded.");
}
else //No external dictionnary found.
{
ConsoleIO.WriteLineFormatted("§8Translations file not found: \"" + Language_File + "\""
+ "\nSome messages won't be properly printed without this file.", true);
+ "\nSome messages won't be properly printed without this file.");
}
}

View file

@ -434,12 +434,12 @@ namespace MinecraftClient.Protocol.Handlers
if (serverID == "-")
{
ConsoleIO.WriteLineFormatted("§8Server is in offline mode.", false);
ConsoleIO.WriteLineFormatted("§8Server is in offline mode.");
return true; //No need to check session or start encryption
}
else
{
ConsoleIO.WriteLineFormatted("§8Handshake successful. (Server ID: " + serverID + ')', false);
ConsoleIO.WriteLineFormatted("§8Handshake successful. (Server ID: " + serverID + ')');
return StartEncryption(uuid, username, sessionID, token, serverID, PublicServerkey);
}
}
@ -451,7 +451,7 @@ namespace MinecraftClient.Protocol.Handlers
System.Security.Cryptography.RSACryptoServiceProvider RSAService = CryptoHandler.DecodeRSAPublicKey(serverKey);
byte[] secretKey = CryptoHandler.GenerateAESPrivateKey();
ConsoleIO.WriteLineFormatted("§8Crypto keys & hash generated.", false);
ConsoleIO.WriteLineFormatted("§8Crypto keys & hash generated.");
if (serverIDhash != "-")
{
@ -675,7 +675,7 @@ namespace MinecraftClient.Protocol.Handlers
protocolversion = (byte)39;
version = "B1.8.1 - 1.3.2";
}
ConsoleIO.WriteLineFormatted("§8Server version : MC " + version + " (protocol v" + protocolversion + ").", false);
ConsoleIO.WriteLineFormatted("§8Server version : MC " + version + " (protocol v" + protocolversion + ").");
return true;
}
else return false;

View file

@ -328,7 +328,7 @@ namespace MinecraftClient.Protocol.Handlers
}
else if (pid == 0x02) //Login successful
{
ConsoleIO.WriteLineFormatted("§8Server is in offline mode.", false);
ConsoleIO.WriteLineFormatted("§8Server is in offline mode.");
StartUpdating();
return true; //No need to check session or start encryption
}
@ -345,7 +345,7 @@ namespace MinecraftClient.Protocol.Handlers
System.Security.Cryptography.RSACryptoServiceProvider RSAService = CryptoHandler.DecodeRSAPublicKey(serverKey);
byte[] secretKey = CryptoHandler.GenerateAESPrivateKey();
ConsoleIO.WriteLineFormatted("§8Crypto keys & hash generated.", false);
ConsoleIO.WriteLineFormatted("§8Crypto keys & hash generated.");
if (serverIDhash != "-")
{
@ -538,7 +538,7 @@ namespace MinecraftClient.Protocol.Handlers
version = "Forge " + version;
protocolversion = 0;
}
ConsoleIO.WriteLineFormatted("§8Server version : " + version + " (protocol v" + protocolversion + ").", false);
ConsoleIO.WriteLineFormatted("§8Server version : " + version + " (protocol v" + protocolversion + ").");
return true;
}
}