diff --git a/PCL.Core/Minecraft/Java/JavaBrandType.cs b/PCL.Core/Minecraft/Java/JavaBrandType.cs index bb8b8b53a..6be510641 100644 --- a/PCL.Core/Minecraft/Java/JavaBrandType.cs +++ b/PCL.Core/Minecraft/Java/JavaBrandType.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace PCL.Core.Minecraft.Java; +namespace PCL.Core.Minecraft.Java; public enum JavaBrandType { diff --git a/PCL.Core/Minecraft/Java/JavaManager.cs b/PCL.Core/Minecraft/Java/JavaManager.cs index 3ebc64384..f0826af0a 100644 --- a/PCL.Core/Minecraft/Java/JavaManager.cs +++ b/PCL.Core/Minecraft/Java/JavaManager.cs @@ -293,9 +293,10 @@ public async Task SelectSuitableJavaAsync(Version minVersion, Versi .Values.ToList() .Where(j => j.Installation.IsStillAvailable && j.IsEnabled && IsVersionSuitable(j.Installation.Version, minVersion, maxVersion)) - .OrderBy(j => j.Installation.Version) - .ThenBy(j => j.Installation.IsJre) - .ThenBy(j => j.Installation.Brand) + .OrderBy(static j => j.Installation.MajorVersion) // 确保首要选择的大版本正确 + .ThenBy(static j => j.Installation.IsJre) // JDK 优先 + .ThenBy(static j => j.Installation.Brand) // Java 发行版优选 + .ThenByDescending(static j => j.Installation.Version) // 优选后小版本号较高的版本 .ToArray(); } }