44
55import java .io .File ;
66import java .util .Arrays ;
7+ import java .util .Collections ;
78import java .util .List ;
9+ import java .util .Locale ;
810import java .util .logging .Logger ;
911
1012public class DefaultLibraryResolver extends AbstractLibraryResolver {
@@ -20,12 +22,24 @@ public DefaultLibraryResolver(Logger logger, File librariesDir) {
2022 * <ul>
2123 * <li><a href="https://mirrors.huaweicloud.com/repository/maven">华为云镜像</a></li>
2224 * <li><a href="https://repo.maven.apache.org/maven2">Maven Central 中心仓库</a></li>
25+ * <li><a href="https://maven-central.storage-download.googleapis.com/maven2">Maven Central 中心仓库(海外)</a></li>
2326 * </ul>
2427 */
2528 public static List <RemoteRepository > getDefaultRepositories () {
26- return Arrays .asList (
27- new RemoteRepository .Builder ("huaweicloud" , "default" , "https://mirrors.huaweicloud.com/repository/maven" ).build (),
28- new RemoteRepository .Builder ("central" , "default" , "https://repo.maven.apache.org/maven2" ).build ()
29- );
29+ if (Locale .getDefault ().getCountry ().equals ("CN" )) {
30+ return Arrays .asList (
31+ new RemoteRepository .Builder ("huaweicloud" , "default" , "https://mirrors.huaweicloud.com/repository/maven" ).build (),
32+ new RemoteRepository .Builder ("central" , "default" , "https://repo.maven.apache.org/maven2" ).build ()
33+ );
34+ } else {
35+ String central = System .getenv ("PAPER_DEFAULT_CENTRAL_REPOSITORY" );
36+ if (central == null ) {
37+ central = System .getProperty ("org.bukkit.plugin.java.LibraryLoader.centralURL" );
38+ }
39+ if (central == null ) {
40+ central = "https://maven-central.storage-download.googleapis.com/maven2" ;
41+ }
42+ return Collections .singletonList (new RemoteRepository .Builder ("central" , "default" , central ).build ());
43+ }
3044 }
3145}
0 commit comments