diff --git a/rulateday-server/pom.xml b/rulateday-server/pom.xml index 717cb6e..884ade6 100644 --- a/rulateday-server/pom.xml +++ b/rulateday-server/pom.xml @@ -280,7 +280,7 @@ com.github.Eiriksgata trpg-java-dice - 1.3.2 + 1.3.4 diff --git a/rulateday-server/src/main/java/indi/eiriksgata/rulateday/config/CustomDocumentHandler.java b/rulateday-server/src/main/java/indi/eiriksgata/rulateday/config/CustomDocumentHandler.java index bedcb30..b295b81 100644 --- a/rulateday-server/src/main/java/indi/eiriksgata/rulateday/config/CustomDocumentHandler.java +++ b/rulateday-server/src/main/java/indi/eiriksgata/rulateday/config/CustomDocumentHandler.java @@ -25,6 +25,9 @@ public static void save(String name, String key, String value) { public static List find(String key) { + if (GlobalData.documentContext == null) { + return null; + } AtomicInteger index = new AtomicInteger(); List result = new ArrayList<>(); GlobalData.documentContext.forEach((docName, dataMap) -> { diff --git a/rulateday-server/src/main/java/indi/eiriksgata/rulateday/instruction/QueryController.java b/rulateday-server/src/main/java/indi/eiriksgata/rulateday/instruction/QueryController.java index e134b96..a3581c3 100644 --- a/rulateday-server/src/main/java/indi/eiriksgata/rulateday/instruction/QueryController.java +++ b/rulateday-server/src/main/java/indi/eiriksgata/rulateday/instruction/QueryController.java @@ -171,18 +171,18 @@ public void groupTemp(GroupTempMessageEvent event) { return null; } - @InstructReflex(value = {".rmi", "。rmi"}) - public String rollMagicItem() { + @InstructReflex(value = {".rmi", "。rmi"}, priority = 3) + public String rollMagicItem(MessageData data) { return "null"; } - @InstructReflex(value = {".rt", "。rt"}) - public String rollTool() { + @InstructReflex(value = {".rt", "。rt"}, priority = 3) + public String rollTool(MessageData data) { return "null"; } - @InstructReflex(value = {".drw", "。drw"}) - public String rollWeapon() { + @InstructReflex(value = {".drw", "。drw"}, priority = 4) + public String rollWeapon(MessageData data) { return "null"; } @@ -202,8 +202,8 @@ public String modClose(MessageData data) { return "null"; } - @InstructReflex(value = {".reload"}) - public String fileReload() { + @InstructReflex(value = {".reload"}, priority = 3) + public String fileReload(MessageData data) { try { LoadDatabaseFile.loadCustomDocument(); } catch (IOException e) { @@ -216,6 +216,9 @@ public String fileReload() { @InstructReflex(value = {".q", "。q", ".Q", "。Q"}, priority = 3) public String queryModelCustom(MessageData data) { List result = CustomDocumentHandler.find(data.getMessage()); + if (result == null) { + return CustomText.getText("query.doc.lib.result.list.not.found"); + } List saveData = new ArrayList<>(); if (result.size() > 1) { StringBuilder text = new StringBuilder(CustomText.getText("query.doc.lib.result.list.title"));