Compare commits

..

No commits in common. "8819cca3e2176e5c9e25ed768bdb46a343d8e497" and "5e56b4932081cb52afcd478620083066b8683455" have entirely different histories.

6 changed files with 14 additions and 55 deletions

View File

@ -48,20 +48,18 @@ public class DataLoader {
} }
public static void CheckAllFiles() { public static void CheckAllFiles() {
String pathSplitter = "defaults" + Pattern.quote(FileSystems.getDefault().getSeparator()) + "data" + Pattern.quote(FileSystems.getDefault().getSeparator());
try { try {
List<Path> filenames = FileUtils.getPathsFromResource("/defaults/data/"); List<Path> filenames = FileUtils.getPathsFromResource("/defaults/data/");
if (filenames == null) {
Grasscutter.getLogger().error("We were unable to locate your default data files.");
}
for (Path file : filenames) { for (Path file : filenames) {
String relativePath = String.valueOf(file).split("defaults[\\\\\\/]data[\\\\\\/]")[1]; String relativePath = String.valueOf(file).split(pathSplitter)[1];
CheckAndCopyData(relativePath); CheckAndCopyData(relativePath);
} }
} catch (Exception e) { } catch (Exception e) {
Grasscutter.getLogger().error("An error occurred while trying to check the data folder.", e); Grasscutter.getLogger().error("An error occurred while trying to check the data folder. \n", e);
} }
GenerateGachaMappings(); GenerateGachaMappings();

View File

@ -58,21 +58,13 @@ public final class GameServer extends KcpServer {
private final CombineManger combineManger; private final CombineManger combineManger;
private final TowerScheduleManager towerScheduleManager; private final TowerScheduleManager towerScheduleManager;
private static InetSocketAddress getAdapterInetSocketAddress(){
InetSocketAddress inetSocketAddress = null;
if(GAME_INFO.bindAddress.equals("")){
inetSocketAddress=new InetSocketAddress(GAME_INFO.bindPort);
}else{
inetSocketAddress=new InetSocketAddress(
GAME_INFO.bindAddress,
GAME_INFO.bindPort
);
}
return inetSocketAddress;
}
public GameServer() { public GameServer() {
this(getAdapterInetSocketAddress()); this(new InetSocketAddress(
GAME_INFO.bindAddress,
GAME_INFO.bindPort
));
} }
public GameServer(InetSocketAddress address) { public GameServer(InetSocketAddress address) {
super(address); super(address);

View File

@ -129,11 +129,7 @@ public final class HttpServer {
*/ */
public void start() { public void start() {
// Attempt to start the HTTP server. // Attempt to start the HTTP server.
if(HTTP_INFO.bindAddress.equals("")){ this.express.listen(HTTP_INFO.bindAddress, HTTP_INFO.bindPort);
this.express.listen(HTTP_INFO.bindPort);
}else{
this.express.listen(HTTP_INFO.bindAddress, HTTP_INFO.bindPort);
}
// Log bind information. // Log bind information.
Grasscutter.getLogger().info(translate("messages.dispatch.port_bind", Integer.toString(this.express.raw().port()))); Grasscutter.getLogger().info(translate("messages.dispatch.port_bind", Integer.toString(this.express.raw().port())));

View File

@ -9,7 +9,6 @@ import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.*; import java.nio.file.*;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -98,11 +97,6 @@ public final class FileUtils {
} catch (Exception e) { } catch (Exception e) {
// Eclipse puts resources in its bin folder // Eclipse puts resources in its bin folder
File f = new File(jarPath + "defaults/data/"); File f = new File(jarPath + "defaults/data/");
if (!f.exists() || f.listFiles().length == 0) {
return null;
}
result = Arrays.stream(f.listFiles()).map(File::toPath).toList(); result = Arrays.stream(f.listFiles()).map(File::toPath).toList();
} }

View File

@ -383,7 +383,8 @@
"title": "Banner Details", "title": "Banner Details",
"available_five_stars": "Available 5-star Items", "available_five_stars": "Available 5-star Items",
"available_four_stars": "Available 4-star Items", "available_four_stars": "Available 4-star Items",
"available_three_stars": "Available 3-star Items" "available_three_stars": "Available 3-star Items",
"template_missing": "data/gacha_details.html is missing."
} }
}, },
"documentation": { "documentation": {

View File

@ -61,7 +61,7 @@
"console_execute_error": "此命令只能在服务器控制台执行呐~", "console_execute_error": "此命令只能在服务器控制台执行呐~",
"player_execute_error": "此命令只能在游戏内执行哦~", "player_execute_error": "此命令只能在游戏内执行哦~",
"command_exist_error": "这条命令...好像找不到呢?", "command_exist_error": "这条命令...好像找不到呢?",
"no_description_specified": "没有指定说明", "no_description_specified": "没有指定说明",
"invalid": { "invalid": {
"amount": "无效的数量。", "amount": "无效的数量。",
"artifactId": "无效的圣遗物ID。", "artifactId": "无效的圣遗物ID。",
@ -229,7 +229,7 @@
"description": "添加或完成任务" "description": "添加或完成任务"
}, },
"reload": { "reload": {
"reload_start": "正在重载配置文件和数据...", "reload_start": "正在重载配置文件和数据",
"reload_done": "重载完成。", "reload_done": "重载完成。",
"description": "重载配置文件和数据" "description": "重载配置文件和数据"
}, },
@ -385,27 +385,5 @@
"available_four_stars": "可获得的4星物品", "available_four_stars": "可获得的4星物品",
"available_three_stars": "可获得的3星物品" "available_three_stars": "可获得的3星物品"
} }
},
"documentation": {
"handbook": {
"title": "GM Handbook",
"title_commands": "命令",
"title_avatars": "角色",
"title_items": "物品",
"title_scenes": "场景",
"title_monsters": "怪物",
"header_id": "ID",
"header_command": "命令",
"header_description": "说明",
"header_avatar": "角色",
"header_item": "物品",
"header_scene": "场景",
"header_monster": "怪物"
},
"index": {
"title": "文档",
"handbook": "GM Handbook",
"gacha_mapping": "祈愿映射 JSON"
}
} }
} }