diff --git a/Source/YAMS-Library/Functions/AutoUpdate.cs b/Source/YAMS-Library/Functions/AutoUpdate.cs
index ad81018..ba4d305 100644
--- a/Source/YAMS-Library/Functions/AutoUpdate.cs
+++ b/Source/YAMS-Library/Functions/AutoUpdate.cs
@@ -39,6 +39,7 @@ public static class AutoUpdate
//Minecraft URLs
public static string strMCClientURL = "https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft.jar";
+ public static string strMCServerURL;
public static string strMCVersionFile = "https://s3.amazonaws.com/Minecraft.Download/versions/versions.json";
//YAMS URLs
@@ -76,7 +77,7 @@ public static void CheckUpdates(bool bolForce = false, bool bolManual = false)
JObject mojangVers = JObject.Parse(jsonMojang);
string releaseVer = (string)mojangVers["latest"]["release"];
string snapshotVer = (string)mojangVers["latest"]["snapshot"];
- string strMCServerURL = "https://s3.amazonaws.com/Minecraft.Download/versions/" + releaseVer + "/minecraft_server." + releaseVer + ".jar";
+ strMCServerURL = "https://s3.amazonaws.com/Minecraft.Download/versions/" + releaseVer + "/minecraft_server." + releaseVer + ".jar";
string strMCPreServerURL = "https://s3.amazonaws.com/Minecraft.Download/versions/" + snapshotVer + "/minecraft_server." + snapshotVer + ".jar";
if (bolForce)
diff --git a/Source/YAMS-Library/Functions/Util.cs b/Source/YAMS-Library/Functions/Util.cs
index 4b4369b..23fffea 100644
--- a/Source/YAMS-Library/Functions/Util.cs
+++ b/Source/YAMS-Library/Functions/Util.cs
@@ -69,6 +69,23 @@ public static bool HasJDK()
}
+ ///
+ /// Looks for a working Minecraft client in any given root folder. Useful for custom paths.
+ /// This works only with the vanilla launcher.
+ ///
+ /// the path to the .minecraft folder
+ /// boolean indicating if the minecraft client is in the specified folder
+ public static bool HasMCClient(string root)
+ {
+ //minecraft.jar is deprecated, but possibly working
+ if (File.Exists(Path.Combine(root, @"bin\minecraft.jar"))) return true;
+
+ //If there is a versions folder, assume that there is a jar file in one of the folders.
+ if (Directory.Exists(Path.Combine(root, @"versions\")) && Directory.GetDirectories(Path.Combine(root, @"versions\")).Length != 0) return true;
+
+ return false;
+ }
+
///
/// Looks for the Minecraft client in the system user's profile, the service runs as LOCAL SYSTEM, so for
/// some of the third party apps we need to see if it is in this profile too
@@ -76,8 +93,7 @@ public static bool HasJDK()
/// boolean indicating if the minecraft client is in the SYSTEM account's AppData
public static bool HasMCClientSystem()
{
- if (File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), @"config\systemprofile\AppData\Roaming\.minecraft\bin\minecraft.jar"))) return true;
- else return false;
+ return HasMCClient(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), @"config\systemprofile\AppData\Roaming\.minecraft\"));
}
///
/// Checks if the Minecraft client is installed locally
@@ -85,8 +101,7 @@ public static bool HasMCClientSystem()
/// boolean indicating if the Minecraft jar is in the local user's AppData
public static bool HasMCClientLocal()
{
- if (File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @".minecraft\bin\minecraft.jar"))) return true;
- else return false;
+ return HasMCClient(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @".minecraft\"));
}
public static void CopyMCClient()
{