Compare commits

...
7 Commits
5 changed files with 14 additions and 13 deletions

No files matched your search

@@ -41,11 +41,5 @@ public class HMCLMinecraftLoader extends MinecraftLoader {
list.add("-Dminecraft.launcher.version=" + Main.LAUNCHER_VERSION);
list.add("-Dminecraft.launcher.brand=" + Main.LAUNCHER_NAME);
boolean flag = false;
for (String s : list) if (s.contains("-Dlog4j.configurationFile=")) flag = true;
if (!flag) {
list.add("-Dlog4j.configurationFile=" + Main.LOG4J_FILE.getAbsolutePath());
}
}
}
@@ -75,6 +75,7 @@ public final class YggdrasilAuthenticator extends AbstractAuthenticator {
if (sel == -1)
throw new AuthenticationException("No selection");
selectedProfile = profiles[sel];
ua.setSelectedProfile(profiles[sel]);
username = names[sel];
} else
username = MessageBox.showInputDialog(C.i18n("login.no_charactor"));
@@ -27,6 +27,7 @@ import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import org.jackhuang.hmcl.util.ArrayUtils;
import org.jackhuang.hmcl.util.C;
@@ -87,6 +88,13 @@ public class YggdrasilAuthentication {
public GameProfile getSelectedProfile() {
return this.selectedProfile;
}
public void setSelectedProfile(GameProfile profile) {
if (profiles != null)
for (GameProfile p : profiles)
if (Objects.equals(profile, p))
selectedProfile = profile;
}
public String getUserId() {
return this.userid;
@@ -43,13 +43,8 @@ public class DefaultGameLauncher extends GameLauncher {
public boolean downloadLibraries(List<DownloadLibraryJob> jobs) {
final TaskWindow.TaskWindowFactory dw = TaskWindow.factory();
ParallelTask parallelTask = new ParallelTask();
HashSet<String> names = new HashSet<>();
for (DownloadLibraryJob s : jobs) {
if (names.contains(s.lib.getName()))
continue;
names.add(s.lib.getName());
for (DownloadLibraryJob s : jobs)
parallelTask.addTask(new LibraryDownloadTask(s, service.getDownloadType()));
}
dw.append(parallelTask);
boolean flag = true;
if (jobs.size() > 0)
@@ -40,6 +40,7 @@ public final class NetUtils {
public static HttpURLConnection createConnection(URL url, Proxy proxy) throws IOException {
HttpURLConnection con = (HttpURLConnection) url.openConnection(proxy);
con.setRequestProperty("User-Agent", "Hello Minecraft!");
con.setDoInput(true);
con.setUseCaches(false);
con.setConnectTimeout(15000);
@@ -48,7 +49,9 @@ public final class NetUtils {
}
public static String get(String url, String encoding) throws IOException {
return IOUtils.toString(new URL(url).openConnection().getInputStream());
HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection();
con.setRequestProperty("User-Agent", "Hello Minecraft!");
return IOUtils.toString(con.getInputStream());
}
public static String get(String url) throws IOException {