diff --git a/Source/YAMS-Library/Functions/AutoUpdate.cs b/Source/YAMS-Library/Functions/AutoUpdate.cs index 81bcd4e..9e20100 100644 --- a/Source/YAMS-Library/Functions/AutoUpdate.cs +++ b/Source/YAMS-Library/Functions/AutoUpdate.cs @@ -69,7 +69,7 @@ public static class AutoUpdate private static string strTectonicusVer = "1.38"; //Checks for available updates - public static void CheckUpdates() + public static void CheckUpdates(bool bolForce = false) { YAMS.Database.AddLog("Running update check", "updater"); @@ -84,6 +84,15 @@ public static void CheckUpdates() string json = File.ReadAllText(YAMS.Core.RootFolder + @"\lib\versions.json"); //Dictionary dicVers = JsonConvert.DeserializeObject>(json); JObject jVers = JObject.Parse(json); + + //Reset all the JAR etags so we re-download them + if (bolForce) + { + YAMS.Database.AddLog("Forced re-download of JAR files", "updater", "warn"); + YAMS.Database.SaveEtag(strMCServerURL, ""); + YAMS.Database.SaveEtag((string)jVers["pre"], ""); + YAMS.Database.SaveEtag(strBukkitServerURL, ""); + } //Check Minecraft server first if (bolUpdateJAR) diff --git a/Source/YAMS-Library/Objects/Server.cs b/Source/YAMS-Library/Objects/Server.cs index 7623379..6d1d8a6 100644 --- a/Source/YAMS-Library/Objects/Server.cs +++ b/Source/YAMS-Library/Objects/Server.cs @@ -366,6 +366,14 @@ private void ServerError(object sender, DataReceivedEventArgs e) } else { strLevel = "error"; } + if (strMessage.IndexOf("Invalid or corrupt jarfile ") > -1) + { + //We have downloaded a corrupt jar, clear the download cache and force a re-download now + this.SafeStop = true; + AutoUpdate.CheckUpdates(true); + this.Start(); + } + Database.AddLog(datTimeStamp, strMessage, "server", strLevel, false, this.ServerID); }