Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.hitech0926</groupId>
<artifactId>HubCommand</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
Expand Down
21 changes: 19 additions & 2 deletions src/main/java/com/hitech0926/hubcommand/HubCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@Plugin(
id = "hubcommand",
name = "HubCommand",
version = "1.0.0",
version = "1.0.3",
authors = {"Hitech0926"}
)
public class HubCommand {
Expand Down Expand Up @@ -75,11 +75,26 @@ public ProxyServer getServer() {
}

private void loadConfig() {
if (!Files.exists(dataDirectory)) {
try {
Files.createDirectories(dataDirectory);
} catch (IOException e) {
logger.error("无法创建插件目录", e);
return;
}
}

File file = dataDirectory.resolve("config.yml").toFile();
Yaml yaml = new Yaml();
if (!file.exists()) {
try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("config.yml")) {
Files.copy(inputStream, file.toPath());
if (inputStream != null) {
Files.copy(inputStream, file.toPath());
logger.info("配置文件已创建!");
} else {
logger.error("无法找到默认配置文件");
return;
}
} catch (IOException e) {
logger.error("无法创建配置文件", e);
return;
Expand All @@ -92,6 +107,8 @@ private void loadConfig() {
sendSuccessful = (String) config.getOrDefault("send-successful", "<green>你已被传送到大厅!");
noPermission = (String) config.getOrDefault("no-permission", "<red>你没有权限执行此命令!");
noConsole = (String) config.getOrDefault("no-console", "<red>只有玩家可以执行此命令!");

logger.info("配置文件加载成功!");
} catch (IOException e) {
logger.error("无法加载配置文件", e);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/velocity-plugin.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"id":"hubcommand","name":"HubCommand","version":"1.0.2","authors":["HitTech0926"],"dependencies":[],"main":"com.hitech0926.hubcommand.HubCommand"}
{"id":"hubcommand","name":"HubCommand","version":"1.0.3","authors":["HitTech0926"],"dependencies":[],"main":"com.hitech0926.hubcommand.HubCommand"}