Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

Commit

Permalink
Remove DownloadSource.CHINA
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgazul committed May 27, 2024
1 parent eba3e6e commit 0512cdc
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,16 @@
package com.mohistmc.network.download;

import com.mohistmc.config.MohistConfigUtil;
import com.mohistmc.util.i18n.i18n;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;

public enum DownloadSource {

MOHIST("https://maven.mohistmc.com/"),
CHINA("https://libraries.mohistmc.cn:25119/releases/"),
GITHUB("https://mohistmc.github.io/maven/");

String url;
public static DownloadSource defaultSource = i18n.isCN() ? CHINA : MOHIST;
final String url;

DownloadSource(String url) {
this.url = url;
Expand All @@ -44,14 +39,14 @@ public String getUrl() {
}

public static DownloadSource get() {
String ds = MohistConfigUtil.sMohist("mohist.libraries_downloadsource", defaultSource.name());
String ds = MohistConfigUtil.sMohist("mohist.libraries_downloadsource", MOHIST.name());
for (DownloadSource me : DownloadSource.values()) {
if (me.name().equalsIgnoreCase(ds)) {
if (isDown(me.url.replace("releases/", "")) != 200) return GITHUB;
return me;
}
}
return defaultSource;
return MOHIST;
}

public static int isDown(String s) {
Expand Down

0 comments on commit 0512cdc

Please sign in to comment.