diff --git a/pom.xml b/pom.xml
index b517eee..60a3963 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.hitech0926
HubCommand
- 1.0.2
+ 1.0.3
8
diff --git a/src/main/java/com/hitech0926/hubcommand/HubCommand.java b/src/main/java/com/hitech0926/hubcommand/HubCommand.java
index a3a4d7f..b63922c 100644
--- a/src/main/java/com/hitech0926/hubcommand/HubCommand.java
+++ b/src/main/java/com/hitech0926/hubcommand/HubCommand.java
@@ -27,7 +27,7 @@
@Plugin(
id = "hubcommand",
name = "HubCommand",
- version = "1.0.0",
+ version = "1.0.3",
authors = {"Hitech0926"}
)
public class HubCommand {
@@ -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;
@@ -92,6 +107,8 @@ private void loadConfig() {
sendSuccessful = (String) config.getOrDefault("send-successful", "你已被传送到大厅!");
noPermission = (String) config.getOrDefault("no-permission", "你没有权限执行此命令!");
noConsole = (String) config.getOrDefault("no-console", "只有玩家可以执行此命令!");
+
+ logger.info("配置文件加载成功!");
} catch (IOException e) {
logger.error("无法加载配置文件", e);
}
diff --git a/src/main/resources/velocity-plugin.json b/src/main/resources/velocity-plugin.json
index 7f1a61c..9745f2b 100644
--- a/src/main/resources/velocity-plugin.json
+++ b/src/main/resources/velocity-plugin.json
@@ -1 +1 @@
-{"id":"hubcommand","name":"HubCommand","version":"1.0.2","authors":["HitTech0926"],"dependencies":[],"main":"com.hitech0926.hubcommand.HubCommand"}
\ No newline at end of file
+{"id":"hubcommand","name":"HubCommand","version":"1.0.3","authors":["HitTech0926"],"dependencies":[],"main":"com.hitech0926.hubcommand.HubCommand"}
\ No newline at end of file