Skip to content

Commit

Permalink
修复自动下载库bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Luohuayu committed Aug 5, 2019
1 parent 8ae3f84 commit 3a84221
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/catserver/server/CatServerLaunch.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ public class CatServerLaunch {
private static boolean disable = false;

public static void main(String[] args) throws Throwable {
loadLibraries();
downloadLibraries();
if (update) System.out.println("服务端版本过旧请更新!");
if (disable) Runtime.getRuntime().exit(0);
if (huanlin) checkEULA();
CatServerPatcher.patch();
Class.forName("net.minecraftforge.fml.relauncher.ServerLaunchWrapper").getDeclaredMethod("main", String[].class).invoke(null, new Object[] { args });
}

private static void loadLibraries() {
private static void downloadLibraries() {
File libListFile = new File("libraries.info");
if (!libListFile.exists()){
System.out.println("首次运行服务端需要下载库文件才能运行,请耐心等待..");
Expand All @@ -47,7 +47,7 @@ private static void loadLibraries() {
String[] args = str.split("\\|");
if (args.length == 3) {
try {
loadLibrary(args[0], args[1], args[2]);
downloadLibrary(args[0], args[1], args[2]);
} catch (IOException e2) {
System.out.println(e2.toString());
hasException = true;
Expand All @@ -63,7 +63,7 @@ private static void loadLibraries() {
System.out.println("校验库文件时发生错误,请检查网络或手动下载,服务端将尝试继续启动!");
}

private static void loadLibrary(String type, String key, String value) throws IOException {
private static void downloadLibrary(String type, String key, String value) throws IOException {
switch (type) {
case "lib": {
File file = new File(key);
Expand All @@ -76,7 +76,7 @@ private static void loadLibrary(String type, String key, String value) throws IO
case "cfg": {
if ("huanlin".equals(key)) huanlin = Boolean.valueOf(value);
if ("update".equals(key)) update = Boolean.valueOf(value);
if ("disable".equals(key)) update = Boolean.valueOf(value);
if ("disable".equals(key)) disable = Boolean.valueOf(value);
break;
}
}
Expand Down

0 comments on commit 3a84221

Please sign in to comment.