Skip to content

Commit

Permalink
NPC配置"点击执行指令"和"发送消息"不存在时跳过
Browse files Browse the repository at this point in the history
  • Loading branch information
lt-name committed Dec 29, 2023
1 parent a3c5a36 commit beb037f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/main/java/com/smallaswater/npc/data/RsNpcConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,19 +206,23 @@ public RsNpcConfig(@NonNull String name, @NonNull Config config) throws RsNpcCon
}

try {
if (!(config.get("点击执行指令") instanceof List)) {
throw new RuntimeException("点击执行指令 配置读取到的内容不是List类型!请检查您的配置格式是否正确!");
if (config.exists("点击执行指令")) {
if (!(config.get("点击执行指令") instanceof List)) {
throw new RuntimeException("点击执行指令 配置读取到的内容不是List类型!请检查您的配置格式是否正确!");
}
this.cmds.addAll(config.getStringList("点击执行指令"));
}
this.cmds.addAll(config.getStringList("点击执行指令"));
}catch (Exception e) {
throw new RsNpcConfigLoadException("NPC配置 点击执行指令加载失败!请检查配置文件!", e);
}

try {
if (!(config.get("发送消息") instanceof List)) {
throw new RuntimeException("发送消息 配置读取到的内容不是List类型!请检查您的配置格式是否正确!");
if (config.exists("发送消息")) {
if (!(config.get("发送消息") instanceof List)) {
throw new RuntimeException("发送消息 配置读取到的内容不是List类型!请检查您的配置格式是否正确!");
}
this.messages.addAll(config.getStringList("发送消息"));
}
this.messages.addAll(config.getStringList("发送消息"));
}catch (Exception e) {
throw new RsNpcConfigLoadException("NPC配置 发送消息加载失败!请检查配置文件!", e);
}
Expand Down

0 comments on commit beb037f

Please sign in to comment.