Reduce output verbosity, default session cache

- Memory session cache will be used by default
 - Verbose messages are now hidden by default
 - Improve ping procedure's Forge handling
 - Fix 1.8.9 and 1.9.0 in mcversion setting
 - SessionCache.cs: fix LF into CRLF
 - Use 1.9 translations instead of 1.8
This commit is contained in:
ORelio 2016-03-10 13:29:05 +01:00
parent d44a76e82c
commit d45f75f9f4
11 changed files with 119 additions and 105 deletions

View file

@ -1,4 +0,0 @@
namespace MinecraftClient.Cache
{
public enum CacheType { NONE, MEMORY, DISK };
}

View file

@ -73,8 +73,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AutoTimeout.cs" /> <Compile Include="AutoTimeout.cs" />
<Compile Include="Cache\CacheType.cs" />
<Compile Include="Cache\SessionCache.cs" />
<Compile Include="ChatBots\Alerts.cs" /> <Compile Include="ChatBots\Alerts.cs" />
<Compile Include="ChatBots\AntiAFK.cs" /> <Compile Include="ChatBots\AntiAFK.cs" />
<Compile Include="ChatBots\AutoRespond.cs" /> <Compile Include="ChatBots\AutoRespond.cs" />
@ -151,6 +149,8 @@
<Compile Include="Protocol\IMinecraftCom.cs" /> <Compile Include="Protocol\IMinecraftCom.cs" />
<Compile Include="Protocol\IMinecraftComHandler.cs" /> <Compile Include="Protocol\IMinecraftComHandler.cs" />
<Compile Include="Protocol\ProtocolHandler.cs" /> <Compile Include="Protocol\ProtocolHandler.cs" />
<Compile Include="Protocol\SessionCache\CacheType.cs" />
<Compile Include="Protocol\SessionCache\SessionCache.cs" />
<Compile Include="Protocol\SessionToken.cs" /> <Compile Include="Protocol\SessionToken.cs" />
<Compile Include="Proxy\ProxyHandler.cs" /> <Compile Include="Proxy\ProxyHandler.cs" />
<Compile Include="Proxy\Handlers\EventArgs\CreateConnectionAsyncCompletedEventArgs.cs" /> <Compile Include="Proxy\Handlers\EventArgs\CreateConnectionAsyncCompletedEventArgs.cs" />

View file

@ -6,6 +6,7 @@ using MinecraftClient.Protocol;
using System.Reflection; using System.Reflection;
using System.Threading; using System.Threading;
using MinecraftClient.Protocol.Handlers.Forge; using MinecraftClient.Protocol.Handlers.Forge;
using MinecraftClient.Protocol.SessionCache;
namespace MinecraftClient namespace MinecraftClient
{ {
@ -86,19 +87,21 @@ namespace MinecraftClient
} }
//Load cached sessions from disk if necessary //Load cached sessions from disk if necessary
if (Settings.CacheType == Cache.CacheType.DISK) if (Settings.SessionCaching == CacheType.Disk)
{ {
Console.WriteLine(Cache.SessionCache.InitializeDiskCache() ? "Cached sessions loaded." : "Cached sessions could not be loaded from disk"); bool cacheLoaded = SessionCache.InitializeDiskCache();
if (Settings.DebugMessages)
ConsoleIO.WriteLineFormatted(cacheLoaded ? "§8Session cache has been successfully loaded from disk." : "§8Cached sessions could not be loaded from disk");
} }
//Asking the user to type in missing data such as Username and Password //Asking the user to type in missing data such as Username and Password
if (Settings.Login == "") if (Settings.Login == "")
{ {
Console.Write(ConsoleIO.basicIO ? "Please type the username of your choice.\n" : "Username : "); Console.Write(ConsoleIO.basicIO ? "Please type the username or email of your choice.\n" : "Login : ");
Settings.Login = Console.ReadLine(); Settings.Login = Console.ReadLine();
} }
if (Settings.Password == "" && (Settings.CacheType == Cache.CacheType.NONE || !Cache.SessionCache.Contains(Settings.Login))) if (Settings.Password == "" && (Settings.SessionCaching == CacheType.None || !SessionCache.Contains(Settings.Login.ToLower())))
{ {
RequestPassword(); RequestPassword();
} }
@ -143,18 +146,17 @@ namespace MinecraftClient
else else
{ {
// Validate cached session or login new session. // Validate cached session or login new session.
if (Settings.CacheType != Cache.CacheType.NONE && Cache.SessionCache.Contains(Settings.Login)) if (Settings.SessionCaching != CacheType.None && SessionCache.Contains(Settings.Login.ToLower()))
{ {
session = Cache.SessionCache.Get(Settings.Login); session = SessionCache.Get(Settings.Login.ToLower());
result = ProtocolHandler.GetTokenValidation(session); result = ProtocolHandler.GetTokenValidation(session);
if (result != ProtocolHandler.LoginResult.Success)
if (result != ProtocolHandler.LoginResult.Success && Settings.Password == "")
{ {
RequestPassword(); ConsoleIO.WriteLineFormatted("§8Cached session is invalid or expired.");
if (Settings.Password == "")
RequestPassword();
} }
else ConsoleIO.WriteLineFormatted("§8Cached session is still valid for " + session.PlayerName + '.');
Console.WriteLine("Cached session is " + (result == ProtocolHandler.LoginResult.Success ? "valid." : "invalid."));
} }
if (result != ProtocolHandler.LoginResult.Success) if (result != ProtocolHandler.LoginResult.Success)
@ -162,9 +164,9 @@ namespace MinecraftClient
Console.WriteLine("Connecting to Minecraft.net..."); Console.WriteLine("Connecting to Minecraft.net...");
result = ProtocolHandler.GetLogin(Settings.Login, Settings.Password, out session); result = ProtocolHandler.GetLogin(Settings.Login, Settings.Password, out session);
if (result == ProtocolHandler.LoginResult.Success && Settings.CacheType != Cache.CacheType.NONE) if (result == ProtocolHandler.LoginResult.Success && Settings.SessionCaching != CacheType.None)
{ {
Cache.SessionCache.Store(Settings.Login, session); SessionCache.Store(Settings.Login.ToLower(), session);
} }
} }
@ -180,7 +182,8 @@ namespace MinecraftClient
if (Settings.playerHeadAsIcon) if (Settings.playerHeadAsIcon)
ConsoleIcon.setPlayerIconAsync(Settings.Username); ConsoleIcon.setPlayerIconAsync(Settings.Username);
Console.WriteLine("Success. (session ID: " + session.ID + ')'); if (Settings.DebugMessages)
Console.WriteLine("Success. (session ID: " + session.ID + ')');
//ProtocolHandler.RealmsListWorlds(Settings.Username, PlayerID, sessionID); //TODO REMOVE //ProtocolHandler.RealmsListWorlds(Settings.Username, PlayerID, sessionID); //TODO REMOVE
@ -221,11 +224,6 @@ namespace MinecraftClient
} }
} }
if (forgeInfo != null && !forgeInfo.Mods.Any())
{
forgeInfo = null;
}
if (protocolversion != 0) if (protocolversion != 0)
{ {
try try

View file

@ -123,7 +123,8 @@ namespace MinecraftClient.Protocol.Handlers
} }
} }
ConsoleIO.WriteLineFormatted("§8Translations file loaded."); if (Settings.DebugMessages)
ConsoleIO.WriteLineFormatted("§8Translations file loaded.");
} }
else //No external dictionnary found. else //No external dictionnary found.
{ {

View file

@ -449,7 +449,7 @@ namespace MinecraftClient.Protocol.Handlers
if (serverID == "-") if (serverID == "-")
ConsoleIO.WriteLineFormatted("§8Server is in offline mode."); ConsoleIO.WriteLineFormatted("§8Server is in offline mode.");
else else if (Settings.DebugMessages)
ConsoleIO.WriteLineFormatted("§8Handshake successful. (Server ID: " + serverID + ')'); ConsoleIO.WriteLineFormatted("§8Handshake successful. (Server ID: " + serverID + ')');
return StartEncryption(uuid, username, sessionID, token, serverID, PublicServerkey); return StartEncryption(uuid, username, sessionID, token, serverID, PublicServerkey);
@ -462,7 +462,8 @@ namespace MinecraftClient.Protocol.Handlers
System.Security.Cryptography.RSACryptoServiceProvider RSAService = CryptoHandler.DecodeRSAPublicKey(serverKey); System.Security.Cryptography.RSACryptoServiceProvider RSAService = CryptoHandler.DecodeRSAPublicKey(serverKey);
byte[] secretKey = CryptoHandler.GenerateAESPrivateKey(); byte[] secretKey = CryptoHandler.GenerateAESPrivateKey();
ConsoleIO.WriteLineFormatted("§8Crypto keys & hash generated."); if (Settings.DebugMessages)
ConsoleIO.WriteLineFormatted("§8Crypto keys & hash generated.");
if (serverIDhash != "-") if (serverIDhash != "-")
{ {

View file

@ -451,13 +451,15 @@ namespace MinecraftClient.Protocol.Handlers
byte fmlProtocolVersion = readNextByte(packetData); byte fmlProtocolVersion = readNextByte(packetData);
// There's another value afterwards for the dimension, but we don't need it. // There's another value afterwards for the dimension, but we don't need it.
ConsoleIO.WriteLineFormatted("§8Forge protocol version : " + fmlProtocolVersion); if (Settings.DebugMessages)
ConsoleIO.WriteLineFormatted("§8Forge protocol version : " + fmlProtocolVersion);
// Tell the server we're running the same version. // Tell the server we're running the same version.
SendForgeHandshakePacket(FMLHandshakeDiscriminator.ClientHello, new byte[] { fmlProtocolVersion }); SendForgeHandshakePacket(FMLHandshakeDiscriminator.ClientHello, new byte[] { fmlProtocolVersion });
// Then tell the server that we're running the same mods. // Then tell the server that we're running the same mods.
ConsoleIO.WriteLineFormatted("§8Sending falsified mod list to server..."); if (Settings.DebugMessages)
ConsoleIO.WriteLineFormatted("§8Sending falsified mod list to server...");
byte[][] mods = new byte[forgeInfo.Mods.Count][]; byte[][] mods = new byte[forgeInfo.Mods.Count][];
for (int i = 0; i < forgeInfo.Mods.Count; i++) for (int i = 0; i < forgeInfo.Mods.Count; i++)
{ {
@ -476,7 +478,8 @@ namespace MinecraftClient.Protocol.Handlers
Thread.Sleep(2000); Thread.Sleep(2000);
ConsoleIO.WriteLineFormatted("§8Accepting server mod list..."); if (Settings.DebugMessages)
ConsoleIO.WriteLineFormatted("§8Accepting server mod list...");
// Tell the server that yes, we are OK with the mods it has // Tell the server that yes, we are OK with the mods it has
// even though we don't actually care what mods it has. // even though we don't actually care what mods it has.
@ -497,8 +500,8 @@ namespace MinecraftClient.Protocol.Handlers
// with blocks and items. // with blocks and items.
int registrySize = readNextVarInt(packetData); int registrySize = readNextVarInt(packetData);
ConsoleIO.WriteLineFormatted("§8Received registry " + if (Settings.DebugMessages)
"with " + registrySize + " entries"); ConsoleIO.WriteLineFormatted("§8Received registry with " + registrySize + " entries");
fmlHandshakeState = FMLHandshakeClientState.PENDINGCOMPLETE; fmlHandshakeState = FMLHandshakeClientState.PENDINGCOMPLETE;
} }
@ -509,14 +512,10 @@ namespace MinecraftClient.Protocol.Handlers
bool hasNextRegistry = readNextBool(packetData); bool hasNextRegistry = readNextBool(packetData);
string registryName = readNextString(packetData); string registryName = readNextString(packetData);
int registrySize = readNextVarInt(packetData); int registrySize = readNextVarInt(packetData);
if (Settings.DebugMessages)
ConsoleIO.WriteLineFormatted("§8Received registry " + registryName + ConsoleIO.WriteLineFormatted("§8Received registry " + registryName + " with " + registrySize + " entries");
" with " + registrySize + " entries");
if (!hasNextRegistry) if (!hasNextRegistry)
{
fmlHandshakeState = FMLHandshakeClientState.PENDINGCOMPLETE; fmlHandshakeState = FMLHandshakeClientState.PENDINGCOMPLETE;
}
} }
return false; return false;
@ -525,9 +524,8 @@ namespace MinecraftClient.Protocol.Handlers
// Just say yes. // Just say yes.
if (discriminator != FMLHandshakeDiscriminator.HandshakeAck) if (discriminator != FMLHandshakeDiscriminator.HandshakeAck)
return false; return false;
if (Settings.DebugMessages)
ConsoleIO.WriteLineFormatted("§8Accepting server registries..."); ConsoleIO.WriteLineFormatted("§8Accepting server registries...");
SendForgeHandshakePacket(FMLHandshakeDiscriminator.HandshakeAck, SendForgeHandshakePacket(FMLHandshakeDiscriminator.HandshakeAck,
new byte[] { (byte)FMLHandshakeClientState.PENDINGCOMPLETE }); new byte[] { (byte)FMLHandshakeClientState.PENDINGCOMPLETE });
fmlHandshakeState = FMLHandshakeClientState.COMPLETE; fmlHandshakeState = FMLHandshakeClientState.COMPLETE;
@ -540,8 +538,8 @@ namespace MinecraftClient.Protocol.Handlers
SendForgeHandshakePacket(FMLHandshakeDiscriminator.HandshakeAck, SendForgeHandshakePacket(FMLHandshakeDiscriminator.HandshakeAck,
new byte[] { (byte)FMLHandshakeClientState.COMPLETE }); new byte[] { (byte)FMLHandshakeClientState.COMPLETE });
ConsoleIO.WriteLine("Forge server connection complete!"); if (Settings.DebugMessages)
ConsoleIO.WriteLine("Forge server connection complete!");
fmlHandshakeState = FMLHandshakeClientState.DONE; fmlHandshakeState = FMLHandshakeClientState.DONE;
return true; return true;
} }
@ -582,7 +580,7 @@ namespace MinecraftClient.Protocol.Handlers
private void ProcessChunkColumnData(int chunkX, int chunkZ, ushort chunkMask, bool hasSkyLight, bool chunksContinuous, List<byte> cache) private void ProcessChunkColumnData(int chunkX, int chunkZ, ushort chunkMask, bool hasSkyLight, bool chunksContinuous, List<byte> cache)
{ {
if (protocolversion >= MC19Version && chunksContinuous && chunkMask == 0) if (protocolversion < MC19Version && chunksContinuous && chunkMask == 0)
{ {
//Unload the entire chunk column //Unload the entire chunk column
handler.GetWorld()[chunkX, chunkZ] = null; handler.GetWorld()[chunkX, chunkZ] = null;
@ -1124,7 +1122,7 @@ namespace MinecraftClient.Protocol.Handlers
{ {
readNextPacket(ref packetID, packetData); readNextPacket(ref packetID, packetData);
if (packetID == 0x40) // Disconect if (packetID == 0x40) // Disconnect
{ {
handler.OnConnectionLost(ChatBot.DisconnectReason.LoginRejected, ChatParser.ParseText(readNextString(packetData))); handler.OnConnectionLost(ChatBot.DisconnectReason.LoginRejected, ChatParser.ParseText(readNextString(packetData)));
return false; return false;
@ -1148,7 +1146,8 @@ namespace MinecraftClient.Protocol.Handlers
System.Security.Cryptography.RSACryptoServiceProvider RSAService = CryptoHandler.DecodeRSAPublicKey(serverKey); System.Security.Cryptography.RSACryptoServiceProvider RSAService = CryptoHandler.DecodeRSAPublicKey(serverKey);
byte[] secretKey = CryptoHandler.GenerateAESPrivateKey(); byte[] secretKey = CryptoHandler.GenerateAESPrivateKey();
ConsoleIO.WriteLineFormatted("§8Crypto keys & hash generated."); if (Settings.DebugMessages)
ConsoleIO.WriteLineFormatted("§8Crypto keys & hash generated.");
if (serverIDhash != "-") if (serverIDhash != "-")
{ {
@ -1408,8 +1407,6 @@ namespace MinecraftClient.Protocol.Handlers
if (protocolversion < 47 && version.Split(' ', '/').Contains("1.8")) if (protocolversion < 47 && version.Split(' ', '/').Contains("1.8"))
protocolversion = ProtocolHandler.MCVer2ProtocolVersion("1.8.0"); protocolversion = ProtocolHandler.MCVer2ProtocolVersion("1.8.0");
ConsoleIO.WriteLineFormatted("§8Server version : " + version + " (protocol v" + protocolversion + ").");
// Check for forge on the server. // Check for forge on the server.
if (jsonData.Properties.ContainsKey("modinfo") && jsonData.Properties["modinfo"].Type == Json.JSONData.DataType.Object) if (jsonData.Properties.ContainsKey("modinfo") && jsonData.Properties["modinfo"].Type == Json.JSONData.DataType.Object)
{ {
@ -1418,13 +1415,24 @@ namespace MinecraftClient.Protocol.Handlers
{ {
forgeInfo = new ForgeInfo(modData); forgeInfo = new ForgeInfo(modData);
ConsoleIO.WriteLineFormatted("§8Server is running forge. Mod list:"); if (forgeInfo.Mods.Any())
foreach (ForgeInfo.ForgeMod mod in forgeInfo.Mods)
{ {
ConsoleIO.WriteLineFormatted("§8 " + mod.ToString()); if (Settings.DebugMessages)
{
ConsoleIO.WriteLineFormatted("§8Server is running Forge. Mod list:");
foreach (ForgeInfo.ForgeMod mod in forgeInfo.Mods)
{
ConsoleIO.WriteLineFormatted("§8 " + mod.ToString());
}
}
else ConsoleIO.WriteLineFormatted("§8Server is running Forge.");
} }
else forgeInfo = null;
} }
} }
ConsoleIO.WriteLineFormatted("§8Server version : " + version + " (protocol v" + protocolversion + (forgeInfo != null ? ", with Forge)." : ")."));
return true; return true;
} }
} }

View file

@ -90,8 +90,8 @@ namespace MinecraftClient.Protocol
void UnregisterPluginChannel(string channel, ChatBot bot); void UnregisterPluginChannel(string channel, ChatBot bot);
/// <summary> /// <summary>
/// Sends a plugin channel packet to the server. See http://wiki.vg/Plugin_channel for more information /// Sends a plugin channel packet to the server.
/// about plugin channels. /// See http://wiki.vg/Plugin_channel for more information about plugin channels.
/// </summary> /// </summary>
/// <param name="channel">The channel to send the packet on.</param> /// <param name="channel">The channel to send the packet on.</param>
/// <param name="data">The payload for the packet.</param> /// <param name="data">The payload for the packet.</param>

View file

@ -123,8 +123,9 @@ namespace MinecraftClient.Protocol
case "1.8.6": case "1.8.6":
case "1.8.7": case "1.8.7":
case "1.8.8": case "1.8.8":
return 47;
case "1.8.9": case "1.8.9":
return 47;
case "1.9.0":
return 107; return 107;
default: default:
return 0; return 0;

View file

@ -0,0 +1,4 @@
namespace MinecraftClient.Protocol.SessionCache
{
public enum CacheType { None, Memory, Disk };
}

View file

@ -6,7 +6,7 @@ using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization.Formatters.Binary;
using System.Timers; using System.Timers;
namespace MinecraftClient.Cache namespace MinecraftClient.Protocol.SessionCache
{ {
/// <summary> /// <summary>
/// Handle sessions caching and storage. /// Handle sessions caching and storage.
@ -14,7 +14,8 @@ namespace MinecraftClient.Cache
public static class SessionCache public static class SessionCache
{ {
const string filename = "cache.bin"; private const string SessionCacheFile = "SessionCache.db";
private static Dictionary<string, SessionToken> sessions = new Dictionary<string, SessionToken>(); private static Dictionary<string, SessionToken> sessions = new Dictionary<string, SessionToken>();
private static FileSystemWatcher cachemonitor = new FileSystemWatcher(); private static FileSystemWatcher cachemonitor = new FileSystemWatcher();
private static Timer updatetimer = new Timer(100); private static Timer updatetimer = new Timer(100);
@ -50,9 +51,11 @@ namespace MinecraftClient.Cache
sessions.Add(login, session); sessions.Add(login, session);
} }
if (Settings.CacheType == CacheType.DISK && updatetimer.Enabled == true) { if (Settings.SessionCaching == CacheType.Disk && updatetimer.Enabled == true)
{
pendingadds.Add(new KeyValuePair<string, SessionToken>(login, session)); pendingadds.Add(new KeyValuePair<string, SessionToken>(login, session));
}else if (Settings.CacheType == CacheType.DISK) }
else if (Settings.SessionCaching == CacheType.Disk)
{ {
SaveToDisk(); SaveToDisk();
} }
@ -78,7 +81,7 @@ namespace MinecraftClient.Cache
{ {
cachemonitor.Path = AppDomain.CurrentDomain.BaseDirectory; cachemonitor.Path = AppDomain.CurrentDomain.BaseDirectory;
cachemonitor.IncludeSubdirectories = false; cachemonitor.IncludeSubdirectories = false;
cachemonitor.Filter = filename; cachemonitor.Filter = SessionCacheFile;
cachemonitor.NotifyFilter = NotifyFilters.LastWrite; cachemonitor.NotifyFilter = NotifyFilters.LastWrite;
cachemonitor.Changed += new FileSystemEventHandler(OnChanged); cachemonitor.Changed += new FileSystemEventHandler(OnChanged);
cachemonitor.EnableRaisingEvents = true; cachemonitor.EnableRaisingEvents = true;
@ -124,11 +127,11 @@ namespace MinecraftClient.Cache
private static bool LoadFromDisk() private static bool LoadFromDisk()
{ {
if (File.Exists(filename)) if (File.Exists(SessionCacheFile))
{ {
try try
{ {
using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read)) using (FileStream fs = new FileStream(SessionCacheFile, FileMode.Open, FileAccess.Read, FileShare.Read))
{ {
sessions = (Dictionary<string, SessionToken>)formatter.Deserialize(fs); sessions = (Dictionary<string, SessionToken>)formatter.Deserialize(fs);
return true; return true;
@ -152,9 +155,9 @@ namespace MinecraftClient.Cache
private static void SaveToDisk() private static void SaveToDisk()
{ {
bool fileexists = File.Exists(filename); bool fileexists = File.Exists(SessionCacheFile);
using (FileStream fs = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None)) using (FileStream fs = new FileStream(SessionCacheFile, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None))
{ {
cachemonitor.EnableRaisingEvents = false; cachemonitor.EnableRaisingEvents = false;

View file

@ -4,6 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using MinecraftClient.Protocol.SessionCache;
namespace MinecraftClient namespace MinecraftClient
{ {
@ -29,9 +30,6 @@ namespace MinecraftClient
public static string SingleCommand = ""; public static string SingleCommand = "";
public static string ConsoleTitle = ""; public static string ConsoleTitle = "";
//Cache Settings
public static Cache.CacheType CacheType = Cache.CacheType.NONE;
//Proxy Settings //Proxy Settings
public static bool ProxyEnabledLogin = false; public static bool ProxyEnabledLogin = false;
public static bool ProxyEnabledIngame = false; public static bool ProxyEnabledIngame = false;
@ -42,8 +40,8 @@ namespace MinecraftClient
public static string ProxyPassword = ""; public static string ProxyPassword = "";
//Other Settings //Other Settings
public static string TranslationsFile_FromMCDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\.minecraft\assets\objects\03\03f31164d234f10a3230611656332f1756e570a9"; //MC 1.8 en_GB.lang public static string TranslationsFile_FromMCDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\.minecraft\assets\objects\3d\3d7f778ea0a3baaf826ae75a094d77c46410902f"; //MC 1.9 en_GB.lang
public static string TranslationsFile_Website_Index = "https://s3.amazonaws.com/Minecraft.Download/indexes/1.8.json"; public static string TranslationsFile_Website_Index = "https://s3.amazonaws.com/Minecraft.Download/indexes/1.9.json";
public static string TranslationsFile_Website_Download = "http://resources.download.minecraft.net"; public static string TranslationsFile_Website_Download = "http://resources.download.minecraft.net";
public static TimeSpan splitMessageDelay = TimeSpan.FromSeconds(2); public static TimeSpan splitMessageDelay = TimeSpan.FromSeconds(2);
public static List<string> Bots_Owners = new List<string>(); public static List<string> Bots_Owners = new List<string>();
@ -60,6 +58,8 @@ namespace MinecraftClient
public static bool DisplayXPBarMessages = true; public static bool DisplayXPBarMessages = true;
public static bool TerrainAndMovements = false; public static bool TerrainAndMovements = false;
public static string PrivateMsgsCmdName = "tell"; public static string PrivateMsgsCmdName = "tell";
public static CacheType SessionCaching = CacheType.None;
public static bool DebugMessages = false;
//AntiAFK Settings //AntiAFK Settings
public static bool AntiAFK_Enabled = false; public static bool AntiAFK_Enabled = false;
@ -187,6 +187,7 @@ namespace MinecraftClient
case "terrainandmovements": TerrainAndMovements = str2bool(argValue); break; case "terrainandmovements": TerrainAndMovements = str2bool(argValue); break;
case "privatemsgscmdname": PrivateMsgsCmdName = argValue.ToLower().Trim(); break; case "privatemsgscmdname": PrivateMsgsCmdName = argValue.ToLower().Trim(); break;
case "botmessagedelay": botMessageDelay = TimeSpan.FromSeconds(str2int(argValue)); break; case "botmessagedelay": botMessageDelay = TimeSpan.FromSeconds(str2int(argValue)); break;
case "debugmessages": DebugMessages = str2bool(argValue); break;
case "botowners": case "botowners":
Bots_Owners.Clear(); Bots_Owners.Clear();
@ -203,10 +204,10 @@ namespace MinecraftClient
} }
break; break;
case "accountcache": case "sessioncache":
if (argValue == "none") { CacheType = Cache.CacheType.NONE; } if (argValue == "none") { SessionCaching = CacheType.None; }
else if (argValue == "memory") { CacheType = Cache.CacheType.MEMORY; } else if (argValue == "memory") { SessionCaching = CacheType.Memory; }
else if (argValue == "disk") { CacheType = Cache.CacheType.DISK; } else if (argValue == "disk") { SessionCaching = CacheType.Disk; }
break; break;
case "accountlist": case "accountlist":
@ -425,11 +426,12 @@ namespace MinecraftClient
+ "showsystemmessages=true #system messages for server ops\r\n" + "showsystemmessages=true #system messages for server ops\r\n"
+ "showxpbarmessages=true #messages displayed above xp bar\r\n" + "showxpbarmessages=true #messages displayed above xp bar\r\n"
+ "terrainandmovements=false #uses more ram, cpu, bandwidth\r\n" + "terrainandmovements=false #uses more ram, cpu, bandwidth\r\n"
+ "accountcache=none #use 'none', 'memory' or 'disk'\r\n" + "sessioncache=memory #use 'none', 'memory' or 'disk'\r\n"
+ "accountlist=accounts.txt\r\n" + "accountlist=accounts.txt\r\n"
+ "serverlist=servers.txt\r\n" + "serverlist=servers.txt\r\n"
+ "playerheadicon=true\r\n" + "playerheadicon=true\r\n"
+ "exitonfailure=false\r\n" + "exitonfailure=false\r\n"
+ "debugmessages=false\r\n"
+ "scriptcache=true\r\n" + "scriptcache=true\r\n"
+ "timestamps=false\r\n" + "timestamps=false\r\n"
+ "\r\n" + "\r\n"