From beb037f0ca9faa9fe2bb285fe3833062929f4778 Mon Sep 17 00:00:00 2001 From: LT_Name <572413378@qq.com> Date: Fri, 29 Dec 2023 19:59:16 +0800 Subject: [PATCH] =?UTF-8?q?NPC=E9=85=8D=E7=BD=AE"=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E6=8C=87=E4=BB=A4"=E5=92=8C"=E5=8F=91?= =?UTF-8?q?=E9=80=81=E6=B6=88=E6=81=AF"=E4=B8=8D=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E6=97=B6=E8=B7=B3=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/smallaswater/npc/data/RsNpcConfig.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/smallaswater/npc/data/RsNpcConfig.java b/src/main/java/com/smallaswater/npc/data/RsNpcConfig.java index 2345bd1..9e88743 100644 --- a/src/main/java/com/smallaswater/npc/data/RsNpcConfig.java +++ b/src/main/java/com/smallaswater/npc/data/RsNpcConfig.java @@ -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); }