mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-05-11 22:45:54 +08:00
Compare commits
4 Commits
5e56b49320
...
8819cca3e2
Author | SHA1 | Date | |
---|---|---|---|
|
8819cca3e2 | ||
|
0dcf28141d | ||
|
c2bf663554 | ||
|
d418d4e3e6 |
@ -48,18 +48,20 @@ public class DataLoader {
|
||||
}
|
||||
|
||||
public static void CheckAllFiles() {
|
||||
String pathSplitter = "defaults" + Pattern.quote(FileSystems.getDefault().getSeparator()) + "data" + Pattern.quote(FileSystems.getDefault().getSeparator());
|
||||
|
||||
try {
|
||||
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) {
|
||||
String relativePath = String.valueOf(file).split(pathSplitter)[1];
|
||||
String relativePath = String.valueOf(file).split("defaults[\\\\\\/]data[\\\\\\/]")[1];
|
||||
|
||||
CheckAndCopyData(relativePath);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Grasscutter.getLogger().error("An error occurred while trying to check the data folder. \n", e);
|
||||
Grasscutter.getLogger().error("An error occurred while trying to check the data folder.", e);
|
||||
}
|
||||
|
||||
GenerateGachaMappings();
|
||||
|
@ -58,13 +58,21 @@ public final class GameServer extends KcpServer {
|
||||
private final CombineManger combineManger;
|
||||
private final TowerScheduleManager towerScheduleManager;
|
||||
|
||||
public GameServer() {
|
||||
this(new InetSocketAddress(
|
||||
GAME_INFO.bindAddress,
|
||||
GAME_INFO.bindPort
|
||||
));
|
||||
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() {
|
||||
this(getAdapterInetSocketAddress());
|
||||
}
|
||||
|
||||
public GameServer(InetSocketAddress address) {
|
||||
super(address);
|
||||
|
||||
|
@ -129,7 +129,11 @@ public final class HttpServer {
|
||||
*/
|
||||
public void start() {
|
||||
// Attempt to start the HTTP server.
|
||||
this.express.listen(HTTP_INFO.bindAddress, HTTP_INFO.bindPort);
|
||||
if(HTTP_INFO.bindAddress.equals("")){
|
||||
this.express.listen(HTTP_INFO.bindPort);
|
||||
}else{
|
||||
this.express.listen(HTTP_INFO.bindAddress, HTTP_INFO.bindPort);
|
||||
}
|
||||
|
||||
// Log bind information.
|
||||
Grasscutter.getLogger().info(translate("messages.dispatch.port_bind", Integer.toString(this.express.raw().port())));
|
||||
|
@ -9,6 +9,7 @@ import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -97,6 +98,11 @@ public final class FileUtils {
|
||||
} catch (Exception e) {
|
||||
// Eclipse puts resources in its bin folder
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -383,8 +383,7 @@
|
||||
"title": "Banner Details",
|
||||
"available_five_stars": "Available 5-star Items",
|
||||
"available_four_stars": "Available 4-star Items",
|
||||
"available_three_stars": "Available 3-star Items",
|
||||
"template_missing": "data/gacha_details.html is missing."
|
||||
"available_three_stars": "Available 3-star Items"
|
||||
}
|
||||
},
|
||||
"documentation": {
|
||||
|
@ -61,7 +61,7 @@
|
||||
"console_execute_error": "此命令只能在服务器控制台执行呐~",
|
||||
"player_execute_error": "此命令只能在游戏内执行哦~",
|
||||
"command_exist_error": "这条命令...好像找不到呢?",
|
||||
"no_description_specified": "没有指定说明。",
|
||||
"no_description_specified": "没有指定说明",
|
||||
"invalid": {
|
||||
"amount": "无效的数量。",
|
||||
"artifactId": "无效的圣遗物ID。",
|
||||
@ -229,7 +229,7 @@
|
||||
"description": "添加或完成任务"
|
||||
},
|
||||
"reload": {
|
||||
"reload_start": "正在重载配置文件和数据。",
|
||||
"reload_start": "正在重载配置文件和数据...",
|
||||
"reload_done": "重载完成。",
|
||||
"description": "重载配置文件和数据"
|
||||
},
|
||||
@ -385,5 +385,27 @@
|
||||
"available_four_stars": "可获得的4星物品",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user