@@ -42,7 +42,6 @@ public static void loadJarLocal(File file) throws MalformedURLException {
42
42
* @param groupId 组ID
43
43
* @param artifactId 构件ID
44
44
* @param version 版本
45
- * @param path 保存目录
46
45
*/
47
46
public static void loadJarMaven (String groupId , String artifactId , String version ) throws RuntimeException , IOException {
48
47
loadJarMaven (groupId ,artifactId ,version ,"" , MiraiMCConfig .General .MavenRepoUrl , new File (MiraiMCConfig .PluginDir , "libraries" ));
@@ -117,23 +116,27 @@ static boolean downloadJarMaven(String repo, String groupId, String artifactId,
117
116
String JarFileURL = String .format (repo , groupId .replace ("." , "/" ), artifactId , version , artifactId , version , extra ); // 下载地址
118
117
119
118
// 检查MD5
120
- Utils .logger .info ("Verifying " + FileName );
119
+ try {
120
+ Utils .logger .info ("Verifying " + FileName );
121
121
122
- File md5File = new File (path , FileName + ".md5" );
123
- String md5FileUrl = JarFileURL + ".md5" ;
122
+ File md5File = new File (path , FileName + ".md5" );
123
+ String md5FileUrl = JarFileURL + ".md5" ;
124
124
125
- if (md5File .exists () && !md5File .delete ()) throw new RuntimeException ("Failed to delete " + md5File .getPath ());
125
+ if (md5File .exists () && !md5File .delete ()) throw new RuntimeException ("Failed to delete " + md5File .getPath ());
126
126
127
- downloadFile (md5File , new URL (md5FileUrl ), false ); // 下载MD5文件
127
+ downloadFile (md5File , new URL (md5FileUrl ), false ); // 下载MD5文件
128
128
129
- if (!md5File .exists ()) throw new RuntimeException ("Failed to download " + md5FileUrl );
129
+ if (!md5File .exists ()) throw new RuntimeException ("Failed to download " + md5FileUrl );
130
130
131
- if (JarFile .exists ()){
132
- FileInputStream fis = new FileInputStream (JarFile );
133
- if (!DigestUtils .md5Hex (fis ).equals (new String (Files .readAllBytes (md5File .toPath ()), StandardCharsets .UTF_8 ))){
134
- fis .close ();
135
- if (!JarFile .delete ()) throw new RuntimeException ("Failed to delete " + JarFile .getPath ());
131
+ if (JarFile .exists ()){
132
+ FileInputStream fis = new FileInputStream (JarFile );
133
+ if (!DigestUtils .md5Hex (fis ).equals (new String (Files .readAllBytes (md5File .toPath ()), StandardCharsets .UTF_8 ))){
134
+ fis .close ();
135
+ if (!JarFile .delete ()) throw new RuntimeException ("Failed to delete " + JarFile .getPath ());
136
+ }
136
137
}
138
+ } catch (RuntimeException e ){
139
+ Utils .logger .warning ("Verify library failed, skipping: " + e .getMessage ());
137
140
}
138
141
139
142
// 下载正式文件
0 commit comments