Skip to content

Commit

Permalink
Updated v2.4 Beta Build 00015
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlSkyCoding committed Feb 6, 2023
1 parent dd2907e commit b914531
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ public static void CreateNewMCThread() throws IOException {
ThreadLogger.NoLine.INFO.Scanner("请输入JAR服务端名称:");
String runjar_mcsm = data.Scan();

ThreadLogger.NoLine.INFO.Scanner("开启MCSM自动启动此服务器(Y/N):");
String Auto = data.Scan();

Boolean AutoStart;

if(Auto.equals("Y")) {
AutoStart = true;
} else {
AutoStart = false;
}

List<String> commandList = new ArrayList();
commandList.add("java");
commandList.add("-jar");
Expand All @@ -52,6 +63,7 @@ public static void CreateNewMCThread() throws IOException {
NewServerJSON.put("ServerName", SERVER_NAME);
NewServerJSON.put("ServerJarName", runjar_mcsm);
NewServerJSON.put("CreateTime", data.Time.getDate());
NewServerJSON.put("AuthStart", AutoStart);

VariableLibrary.Storage.HashMapServerJSONObject.put(Only_ID, NewServerJSON);
VariableLibrary.Storage.HashMapServerOutput.put(Only_ID, "我的世界服务器 输出记录仪记录中...\nMinecraft Server Output Recording...\n");
Expand All @@ -62,6 +74,7 @@ public static void CreateNewMCThread() throws IOException {
SetContent.put("ServerName",SERVER_NAME);
SetContent.put("ServerDir",dir);
SetContent.put("ServerJarName",runjar_mcsm);
SetContent.put("AutoStart", AutoStart);

// 写入 Server List

Expand Down Expand Up @@ -109,6 +122,7 @@ public static void RegisterNewMCThread(String SERVER_NAME, String dir, String ru
NewServerJSON.put("ServerName", SERVER_NAME);
NewServerJSON.put("ServerJarName", runjar_mcsm);
NewServerJSON.put("CreateTime", data.Time.getDate());
NewServerJSON.put("AuthStart", true);

VariableLibrary.Storage.HashMapServerJSONObject.put(Only_ID, NewServerJSON);
VariableLibrary.Storage.HashMapServerOutput.put(Only_ID, "我的世界服务器 输出记录仪记录中...\nMinecraft Server Output Recording...\n");
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/cn/carlsky/nlr/mcsm/System/Initialization.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ public static void Start() throws IOException {
String SERVER_NAME = JSONValue.getString("ServerName");
String SERVER_DIR = JSONValue.getString("ServerDir");
String SERVER_JAR = JSONValue.getString("ServerJarName");
Boolean SERVER_AUTOSTART = JSONValue.getBoolean("AutoStart");

if (SERVER_AUTOSTART) {
ProcessFunctionLibrary.RegisterNewMCThread(SERVER_NAME, SERVER_DIR, SERVER_JAR, entry.getKey());
ThreadLogger.INFO.Output(" 已注册服务器:" + entry.getKey() + ":" + entry.getValue());
}

ProcessFunctionLibrary.RegisterNewMCThread(SERVER_NAME, SERVER_DIR, SERVER_JAR, entry.getKey());
ThreadLogger.INFO.Output(" 已注册服务器:" + entry.getKey() + ":" + entry.getValue());
}

}
Expand Down

0 comments on commit b914531

Please sign in to comment.