diff --git a/forge/src/main/java/cn/evole/mods/mcbot/util/locale/I18n.java b/forge/src/main/java/cn/evole/mods/mcbot/util/locale/I18n.java index 44add026..e9f4b138 100644 --- a/forge/src/main/java/cn/evole/mods/mcbot/util/locale/I18n.java +++ b/forge/src/main/java/cn/evole/mods/mcbot/util/locale/I18n.java @@ -83,6 +83,11 @@ public static String get(String key, Object... args) { } public static String get(String key) { - return translations.get(key); + String translation = translations.get(key); + if (translation != null) { + return translation; + } else { + return key; + } } } diff --git a/forge/src/main/java/cn/evole/mods/mcbot/util/onebot/BotUtils.java b/forge/src/main/java/cn/evole/mods/mcbot/util/onebot/BotUtils.java index 1d9e47dc..8bc5bd3c 100644 --- a/forge/src/main/java/cn/evole/mods/mcbot/util/onebot/BotUtils.java +++ b/forge/src/main/java/cn/evole/mods/mcbot/util/onebot/BotUtils.java @@ -48,7 +48,7 @@ private static boolean isVar(String msg) { public static String varParse(CustomCmd customCmd, String cmd) { String returnCmd = ""; if (isVar(cmd)) {//存在变量 - val replaceContent = customCmd.getCmdContent().split("%")[0].replaceAll(" ", ""); + val replaceContent = customCmd.getCmdContent().split("%")[0].trim(); returnCmd = cmd.replace(customCmd.getCmdAlies(), replaceContent);//返回q群指令 } else returnCmd = customCmd.getCmdContent();//返回普通自定义命令指令 return returnCmd;