From edc15cdebf094d9030b017fad09ee547013d56a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=B1=BBC=E8=AF=AD=E8=A8=80=E6=98=AF=E4=B8=80=E5=AE=B6?= <51352133+F-Unction@users.noreply.github.com> Date: Tue, 26 Apr 2022 10:19:37 +0800 Subject: [PATCH 01/39] update org.reflections 0.9.12->0.10.2 to avoid `[INFO] Unknown command` (#148) --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 97477456a..6dc53ca61 100644 --- a/build.gradle +++ b/build.gradle @@ -33,7 +33,7 @@ dependencies { implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.8' implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.18.1' - implementation group: 'org.reflections', name: 'reflections', version: '0.9.12' + implementation group: 'org.reflections', name: 'reflections', version: '0.10.2' implementation group: 'dev.morphia.morphia', name: 'core', version: '1.6.1' From d19bc12761f4146518880d69a1f56ca034a26aff Mon Sep 17 00:00:00 2001 From: Magix Date: Tue, 26 Apr 2022 21:37:28 -0400 Subject: [PATCH 02/39] Update Grasscutter.java why do i have to fix stable --- src/main/java/emu/grasscutter/Grasscutter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/emu/grasscutter/Grasscutter.java b/src/main/java/emu/grasscutter/Grasscutter.java index abcdc3557..ad1107e8e 100644 --- a/src/main/java/emu/grasscutter/Grasscutter.java +++ b/src/main/java/emu/grasscutter/Grasscutter.java @@ -34,7 +34,7 @@ public final class Grasscutter { private static DispatchServer dispatchServer; private static GameServer gameServer; - public static final Reflections reflector = new Reflections(); + public static final Reflections reflector = new Reflections("emu.grasscutter"); static { // Declare logback configuration. From 7de9507012731a1c4e6369b84c0000f833a50c75 Mon Sep 17 00:00:00 2001 From: memetrollsXD Date: Sat, 30 Apr 2022 23:01:28 +0200 Subject: [PATCH 03/39] Delete bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 38 ---------------------------- 1 file changed, 38 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index dd84ea782..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] - -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] - -**Additional context** -Add any other context about the problem here. From 7d7226aac19310840f10862b7fc86af11b451f2d Mon Sep 17 00:00:00 2001 From: memetrollsXD Date: Sat, 30 Apr 2022 23:01:35 +0200 Subject: [PATCH 04/39] Delete feature_request.md --- .github/ISSUE_TEMPLATE/feature_request.md | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bbcbbe7d6..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. From 6b81b888a1d8d428d76a91d347cca385548fba29 Mon Sep 17 00:00:00 2001 From: 66Leo66 <33322229+66Leo66@users.noreply.github.com> Date: Thu, 5 May 2022 21:22:29 +0800 Subject: [PATCH 05/39] Allow overriding config with ENV (#506) Allow overriding config with ENV (handy when running with docker or debugging without modifying script) Also log proxy config for easier debugging (when sharing screenshots) --- proxy_config.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/proxy_config.py b/proxy_config.py index 5025a974e..07bac1a3a 100644 --- a/proxy_config.py +++ b/proxy_config.py @@ -1,4 +1,17 @@ +import os + # This can also be replaced with another IP address. USE_SSL = True -REMOTE_HOST = "127.0.0.1" -REMOTE_PORT = 443 \ No newline at end of file +REMOTE_HOST = "localhost" +REMOTE_PORT = 443 + +if os.getenv('MITM_REMOTE_HOST') != None: + REMOTE_HOST = os.getenv('MITM_REMOTE_HOST') +if os.getenv('MITM_REMOTE_PORT') != None: + REMOTE_PORT = int(os.getenv('MITM_REMOTE_PORT')) +if os.getenv('MITM_USE_SSL') != None: + USE_SSL = bool(os.getenv('MITM_USE_SSL')) + +print('MITM Remote Host: ' + REMOTE_HOST) +print('MITM Remote Port: ' + str(REMOTE_PORT)) +print('MITM Use SSL ' + str(USE_SSL)) From 7a084100c6b6b6d1cb2100c2fd41009cdd026afb Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Thu, 5 May 2022 23:57:55 -0400 Subject: [PATCH 06/39] Convert to the superior language system. (pt. 1) --- build.gradle | 2 +- .../java/emu/grasscutter/Grasscutter.java | 79 ++--- .../emu/grasscutter/languages/CNLanguage.java | 285 ----------------- .../emu/grasscutter/languages/Language.java | 300 ------------------ .../java/emu/grasscutter/plugin/api/README.md | 2 - .../java/emu/grasscutter/utils/Language.java | 82 +++++ 6 files changed, 104 insertions(+), 646 deletions(-) delete mode 100644 src/main/java/emu/grasscutter/languages/CNLanguage.java delete mode 100644 src/main/java/emu/grasscutter/languages/Language.java delete mode 100644 src/main/java/emu/grasscutter/plugin/api/README.md create mode 100644 src/main/java/emu/grasscutter/utils/Language.java diff --git a/build.gradle b/build.gradle index 6da62b032..8c9257777 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,7 @@ plugins { // Eclipse Support id 'eclipse' - // Intelij Support + // IntelliJ Support id 'idea' // Maven diff --git a/src/main/java/emu/grasscutter/Grasscutter.java b/src/main/java/emu/grasscutter/Grasscutter.java index f322e5fdf..bc893ef33 100644 --- a/src/main/java/emu/grasscutter/Grasscutter.java +++ b/src/main/java/emu/grasscutter/Grasscutter.java @@ -4,9 +4,7 @@ import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOError; -import java.net.InetSocketAddress; import java.util.Calendar; -import java.util.Locale; import emu.grasscutter.command.CommandMap; import emu.grasscutter.plugin.PluginManager; @@ -28,24 +26,25 @@ import com.google.gson.GsonBuilder; import ch.qos.logback.classic.Logger; import emu.grasscutter.data.ResourceLoader; import emu.grasscutter.database.DatabaseManager; -import emu.grasscutter.languages.CNLanguage; -import emu.grasscutter.languages.Language; +import emu.grasscutter.utils.Language; import emu.grasscutter.server.dispatch.DispatchServer; import emu.grasscutter.server.game.GameServer; import emu.grasscutter.tools.Tools; import emu.grasscutter.utils.Crypto; +import static emu.grasscutter.utils.Language.translate; + public final class Grasscutter { private static final Logger log = (Logger) LoggerFactory.getLogger(Grasscutter.class); - private static Config config; private static LineReader consoleLineReader = null; + + private static Config config; private static Language language; - private static CNLanguage cn_language; private static final Gson gson = new GsonBuilder().setPrettyPrinting().create(); private static final File configFile = new File("./config.json"); - private static int day; // Current day of week + private static int day; // Current day of week. private static DispatchServer dispatchServer; private static GameServer gameServer; @@ -60,7 +59,7 @@ public final class Grasscutter { // Load server configuration. Grasscutter.loadConfig(); - // Load Language + // Load translation files. Grasscutter.loadLanguage(); // Check server structure. @@ -68,21 +67,18 @@ public final class Grasscutter { } public static void main(String[] args) throws Exception { - Crypto.loadKeys(); + Crypto.loadKeys(); // Load keys from buffers. + // Parse arguments. for (String arg : args) { switch (arg.toLowerCase()) { - case "-handbook" -> { - Tools.createGmHandbook(); return; - } - case "-gachamap" -> { - Tools.createGachaMapping(); return; - } + case "-handbook" -> Tools.createGmHandbook(); + case "-gachamap" -> Tools.createGachaMapping(); } } // Initialize server. - Grasscutter.getLogger().info(language.Starting_Grasscutter); + Grasscutter.getLogger().info(translate("messages.status.starting")); // Load all resources. Grasscutter.updateDayOfWeek(); @@ -97,7 +93,7 @@ public final class Grasscutter { // Create server instances. dispatchServer = new DispatchServer(); - gameServer = new GameServer(new InetSocketAddress(getConfig().getGameServerOptions().Ip, getConfig().getGameServerOptions().Port)); + gameServer = new GameServer(); // Create a server hook instance with both servers. new ServerHook(gameServer, dispatchServer); @@ -110,9 +106,9 @@ public final class Grasscutter { } else if (getConfig().RunMode == ServerRunMode.GAME_ONLY) { gameServer.start(); } else { - getLogger().error(language.Invalid_server_run_mode + " " + getConfig().RunMode); - getLogger().error(language.Server_run_mode); - getLogger().error(language.Shutting_down); + getLogger().error(translate("messages.status.run_mode_error", getConfig().RunMode)); + getLogger().error(translate("messages.status.run_mode_help")); + getLogger().error(translate("messages.status.shutdown")); System.exit(1); } @@ -145,41 +141,8 @@ public final class Grasscutter { } public static void loadLanguage() { - try (FileReader file = new FileReader(String.format("%s%s.json", getConfig().LANGUAGE_FOLDER, Grasscutter.config.LocaleLanguage))) { - language = gson.fromJson(file, Language.class); - } catch (Exception e) { - Grasscutter.language = new Language(); - Grasscutter.cn_language = new CNLanguage(); - Grasscutter.config.LocaleLanguage = Locale.getDefault(); - saveConfig(); - - try { - File folder = new File("./languages"); - if (!folder.exists() && !folder.isDirectory()) { - //noinspection ResultOfMethodCallIgnored - folder.mkdirs(); - } - } catch (Exception ee) { - Grasscutter.getLogger().error("Unable to create language folder."); - } - try (FileWriter file = new FileWriter("./languages/" + Locale.US + ".json")) { - file.write(gson.toJson(language)); - } catch (Exception ee) { - Grasscutter.getLogger().error("Unable to create language file."); - } - try (FileWriter file = new FileWriter("./languages/" + Locale.SIMPLIFIED_CHINESE + ".json")) { - file.write(gson.toJson(cn_language)); - } catch (Exception ee) { - Grasscutter.getLogger().error("无法创建简体中文语言文件。"); - } - - // try again - try (FileReader file = new FileReader(String.format("%s%s.json", getConfig().LANGUAGE_FOLDER, Grasscutter.config.LocaleLanguage))) { - language = gson.fromJson(file, Language.class); - } catch (Exception ee) { - Grasscutter.getLogger().error("Unable to load " + Grasscutter.config.LocaleLanguage + ".json"); - } - } + var locale = config.LocaleLanguage; + language = Language.getLanguage(locale.toLanguageTag()); } public static void saveConfig() { @@ -193,11 +156,11 @@ public final class Grasscutter { public static void startConsole() { // Console should not start in dispatch only mode. if (getConfig().RunMode == ServerRunMode.DISPATCH_ONLY) { - getLogger().info(language.Dispatch_mode_not_support_command); + getLogger().info(translate("messages.dispatch.no_commands_error")); return; } - getLogger().info(language.Start_done); + getLogger().info(translate("messages.status.done")); String input = null; boolean isLastInterrupted = false; while (true) { @@ -223,7 +186,7 @@ public final class Grasscutter { try { CommandMap.getInstance().invoke(null, null, input); } catch (Exception e) { - Grasscutter.getLogger().error(language.Command_error, e); + Grasscutter.getLogger().error(translate("messages.game.command_error"), e); } } } diff --git a/src/main/java/emu/grasscutter/languages/CNLanguage.java b/src/main/java/emu/grasscutter/languages/CNLanguage.java deleted file mode 100644 index 48123c778..000000000 --- a/src/main/java/emu/grasscutter/languages/CNLanguage.java +++ /dev/null @@ -1,285 +0,0 @@ -package emu.grasscutter.languages; - -public final class CNLanguage { - public String An_error_occurred_during_game_update = "游戏更新时发生了错误."; - public String Starting_Grasscutter = "正在开启Grasscutter..."; - public String Invalid_server_run_mode = "无效的服务器运行模式. "; - public String Server_run_mode = "服务器运行模式必须为以下几种之一: 'HYBRID'(混合模式), 'DISPATCH_ONLY'(仅dispatch模式), 或 'GAME_ONLY'(仅游戏模式). 无法启动Grasscutter..."; - public String Shutting_down = "正在停止...."; - public String Start_done = "加载完成!需要指令帮助请输入 \"help\""; - public String Dispatch_mode_not_support_command = "仅dispatch模式无法使用指令。"; - public String Command_error = "命令错误:"; - public String Error = "出现错误."; - public String Grasscutter_is_free = "Grasscutter是免费软件,如果你是花钱买到的,你大概被骗了。主页: https://github.com/Grasscutters/Grasscutter"; - public String Game_start_port = "游戏服务器已在端口 {port} 上开启。"; - public String Client_connect = "来自 {address} 的客户端已连接。"; - public String Client_disconnect = "来自 {address} 的客户端已断开。"; - public String Client_request = "[Dispatch] 客户端 {ip} 请求: {method} {url}"; - public String Not_load_keystore = "[Dispatch] 无法加载证书,正在尝试默认密码..."; - public String Use_default_keystore = "[Dispatch] 成功使用默认密码加载证书. 请考虑将config.json中的KeystorePassword项改为123456."; - public String Load_keystore_error = "[Dispatch] 加载证书时出现错误!"; - public String Not_find_ssl_cert = "[Dispatch] 未找到SSL证书,正在回滚至HTTP模式。"; - public String Welcome = "欢迎使用Grasscutter"; - public String Potential_unhandled_request = "[Dispatch] 潜在的未处理请求: {method} {url}"; - public String Client_login_token = "[Dispatch] 客户端 {ip} 正在尝试使用token登录..."; - public String Client_token_login_failed = "[Dispatch] 客户端 {ip} 使用token登录失败。"; - public String Client_login_in_token = "[Dispatch] 客户端 {ip} 使用token以 {uid} 的身份登录。"; - public String Game_account_cache_error = "游戏账户缓存出现错误。"; - public String Wrong_session_key = "会话密钥错误。"; - public String Client_exchange_combo_token = "[Dispatch] 客户端 {ip} 成功交换token。"; - public String Client_failed_exchange_combo_token = "[Dispatch] 客户端 {ip} 交换token失败。"; - public String Dispatch_start_server_port = "[Dispatch] Dispatch服务器已在端口 {port} 上开启。"; - public String Client_failed_login_account_create = "[Dispatch] 客户端 {ip} 登录失败: 已创建UID为 {uid} 的账户。"; - public String Client_failed_login_account_create_failed = "[Dispatch] 客户端 {ip} 登录失败: 创建账户失败。"; - public String Client_failed_login_account_no_found = "[Dispatch] 客户端 {ip} 登录失败: 未找到帐户。"; - public String Client_login = "[Dispatch] 客户端 {ip} 以 {uid} 的身份登录。"; - public String Username_not_found = "未找到此用户名."; - public String Username_not_found_create_failed = "未找到此用户名, 创建失败。."; - - // Command - public String No_command_specified = "未指定命令."; - public String Unknown_command = "未知命令: "; - public String You_not_permission_run_command = "你没有权限运行此命令."; - public String This_command_can_only_run_from_console = "此命令只能在控制台运行."; - public String Run_this_command_in_game = "请在游戏内运行此命令."; - public String Invalid_playerId = "无效的玩家ID."; - public String Player_not_found = "未找到此玩家."; - public String Player_is_offline = "此玩家已离线."; - public String Invalid_item_id = "无效的物品ID."; - public String Invalid_item_or_player_id = "无效的玩家或物品ID."; - public String Enabled = "启用"; - public String Disabled = "禁用"; - public String No_command_found = "未找到命令."; - public String Help = "帮助"; - public String Player_not_found_or_offline = "此玩家不存在或已离线."; - public String Invalid_arguments = "无效的参数."; - public String Success = "成功"; - public String Invalid_entity_id = "无效的实体ID."; - - // Help - public String Help_usage = " 用法: "; - public String Help_aliases = " 别名: "; - public String Help_available_command = " 可用命令:"; - - // Account - public String Modify_user_account = "修改用户帐户"; - public String Invalid_UID = "无效的UID."; - public String Account_exists = "账户已存在."; - public String Account_create_UID = "UID为 {uid} 的账户已创建."; - public String Account_delete = "已删除账户."; - public String Account_not_find = "账户不存在."; - public String Account_command_usage = "用法: account <用户名> [uid]"; - - // Broadcast - public String Broadcast_command_usage = "用法: broadcast <消息>"; - public String Broadcast_message_sent = "消息已发送."; - - // ChangeScene - public String Change_screen_usage = "用法: changescene <场景id>"; - public String Change_screen_you_in_that_screen = "你已经在此场景中了"; - public String Change_screen = "切换到场景 "; - public String Change_screen_not_exist = "此场景不存在。"; - - // Clear - public String Clear_weapons = "已清除 {name} 的武器."; - public String Clear_artifacts = "已清除 {name} 的圣遗物 ."; - public String Clear_materials = "已清除 {name} 的材料."; - public String Clear_furniture = "已清除 {name} 的摆设."; - public String Clear_displays = "已清除 {name} 的displays."; - public String Clear_virtuals = "已清除 {name} 的virtuals."; - public String Clear_everything = "已清除 {name} 的所有物品."; - - // Coop - public String Coop_usage = "用法: coop <玩家ID> <房主的玩家ID>"; - - // Drop - public String Drop_usage = "用法: drop <物品ID|物品名> [数量]"; - public String Drop_dropped_of = "已在地上丢弃 {amount} 个 {item}."; - - // EnterDungeon - public String EnterDungeon_usage = "用法: enterdungeon <副本 id>"; - public String EnterDungeon_changed_to_dungeon = "已进入副本 "; - public String EnterDungeon_dungeon_not_found = "副本不存在"; - public String EnterDungeon_you_in_that_dungeon = "你已经在此副本中了。"; - - // GiveAll - public String GiveAll_usage = "用法: giveall [玩家] [数量]"; - public String GiveAll_item = "正在给予所有物品..."; - public String GiveAll_done = "完成。"; - public String GiveAll_invalid_amount_or_playerId = "无效的数量或玩家ID"; - - // GiveArtifact - public String GiveArtifact_usage = "用法: giveart|gart [玩家] <圣遗物Id> <主词条Id> [<副词条Id>[,<被强化次数>]]... [等级]"; - public String GiveArtifact_invalid_artifact_id = "无效的圣遗物Id."; - public String GiveArtifact_given = "已将 {itemId} 给予 {target}."; - - // GiveChar - public String GiveChar_usage = "用法: givechar <角色Id|角色名> [等级]"; - public String GiveChar_given = "将等级为 {level} 的 {avatarId} 给予 {target}."; - public String GiveChar_invalid_avatar_id = "无效的角色ID"; - public String GiveChar_invalid_avatar_level = "无效的角色等级."; - public String GiveChar_invalid_avatar_or_player_id = "无效的角色ID或玩家ID."; - - // Give - public String Give_usage = "用法: give [玩家名] <物品ID|物品名> [数量] [等级] "; - public String Give_refinement_only_applicable_weapons = "精炼只对武器有效。"; - public String Give_refinement_must_between_1_and_5 = "精炼等级必须在1和5之间。"; - public String Give_given = "已将 {amount} 个 {item} 给与 {target}."; - public String Give_given_with_level_and_refinement = "已将 {amount} 个等级为 {lvl}, 精炼 {refinement} 的 {item} 给予 {target}."; - public String Give_given_level = "已将 {amount} 个等级为 {lvl} 的 {item} 给与 {target}."; - - // GodMode - public String Godmode_status = "设置 {name} 的无敌模式为 {status} "; - - // Heal - public String Heal_message = "所有角色已被治疗。"; - - // Kick - public String Kick_player_kick_player = "玩家 [{sendUid}:{sendName}] 已踢出 [{kickUid}:{kickName}]"; - public String Kick_server_player = "正在踢出玩家 [{kickUid}:{kickName}]"; - - // Kill - public String Kill_usage = "用法: killall [玩家UID] [场景ID]"; - public String Kill_scene_not_found_in_player_world = "未在玩家世界中找到此场景"; - public String Kill_kill_monsters_in_scene = "已杀死场景 {id} 中的 {size} 只怪物。 "; - - // KillCharacter - public String KillCharacter_usage = "用法: /killcharacter [玩家Id]"; - public String KillCharacter_kill_current_character = "已干掉 {name} 当前的场上角色."; - - // List - public String List_message = "现有 {size} 名玩家在线:"; - - // Permission - public String Permission_usage = "用法: permission <用户名> <权限名>"; - public String Permission_add = "权限已添加。"; - public String Permission_have_permission = "此玩家已拥有此权限!"; - public String Permission_remove = "权限已移除。"; - public String Permission_not_have_permission = "此玩家未拥有此权限!"; - - // Position - public String Position_message = "坐标: {x},{y},{z}\n场景: {id}"; - - // Reload - public String Reload_reload_start = "正在重新加载配置."; - public String Reload_reload_done = "完成."; - - // ResetConst - public String ResetConst_reset_all = "重置你所有角色的命座。"; - public String ResetConst_reset_all_done = "{name} 的命座已被重置。请重新登录。"; - - // ResetShopLimit - public String ResetShopLimit_usage = "用法: /resetshop <玩家id>"; - - // SendMail - public String SendMail_usage = "用法: give [player] [amount]"; - public String SendMail_user_not_exist = "不存在id为 '{id}' 的用户。"; - public String SendMail_start_composition = "开始编辑邮件的组成部分.\n请使用 `/sendmail <标题>` 以继续.\n你可以在任何时候使用`/sendmail stop` 来停止编辑."; - public String SendMail_templates = "很快就会有邮件模板了......."; - public String SendMail_invalid_arguments = "无效的参数.\n用法: `/sendmail <用户Id|all|help> [模板Id]``"; - public String SendMail_send_cancel = "已取消发送邮件。"; - public String SendMail_send_done = "已向 {name} 发送邮件!"; - public String SendMail_send_all_done = "已向所有玩家发送邮件!"; - public String SendMail_not_composition_end = "邮件组成部分编辑尚未结束.\n请使用 `/sendmail {args}` 或 `/sendmail stop` 来停止编辑"; - public String SendMail_Please_use = "请使用 `/sendmail {args}`"; - public String SendMail_set_title = "邮件标题已设为 '{title}'.\n使用 '/sendmail <邮件正文>' 以继续."; - public String SendMail_set_contents = "邮件的正文如下:\n '{contents}'\n使用 '/sendmail <发送者署名>' 以继续."; - public String SendMail_set_message_sender = "邮件的发送者已设为 '{send}'.\n使用 '/sendmail <物品Id|物品名|finish(结束编辑并发送)> [数量] [等级]"; - public String SendMail_send = "已将 {amount} 个 {item} (等级 {lvl}) 作为邮件附件.\n你可以继续添加附件,也可以使用 `/sendmail finish` 来停止编辑并发送邮件."; - public String SendMail_invalid_arguments_please_use = "无效的参数 \n 请使用 `/sendmail {args}`"; - public String SendMail_title = "<标题>"; - public String SendMail_message = "<正文>"; - public String SendMail_sender = "<发送者>"; - public String SendMail_arguments = "<物品Id|物品名|finish(结束编辑并发送)> [数量] [等级]"; - public String SendMail_error = "错误:无效的编写阶段 {stage}. 需要stacktrace请看服务器命令行."; - - // SendMessage - public String SendMessage_usage = "用法: sendmessage <玩家名> <消息>"; - public String SenaMessage_message_sent = "已发送."; - - // SetFetterLevel - public String SetFetterLevel_usage = "用法: setfetterlevel <等级>"; - public String SetFetterLevel_fetter_level_must_between_0_and_10 = "设置的好感等级必须位于 0 和 10 之间。"; - public String SetFetterLevel_fetter_set_level = "好感等级已设置为 {level}"; - public String SetFetterLevel_invalid_fetter_level = "无效的好感等级。"; - - // SetStats - public String SetStats_usage = "用法: setstats|stats "; - public String SetStats_setstats_help_message = "用法: /setstats|stats <数值> 基本属性(整数)"; - public String SetStats_stats_help_message = "用法: /stats <数值> 元素属性(百分比)"; - public String SetStats_set_max_hp = "最大生命值已设为 {int}."; - public String SetStats_set_max_hp_error = "无效的生命数值."; - public String SetStats_set_hp = "生命设置为 {int}."; - public String SetStats_set_hp_error = "无效的生命数值."; - public String SetStats_set_def = "防御力设置为 {int}."; - public String SetStats_set_def_error = "无效的防御力数值."; - public String SetStats_set_atk = "攻击力设置为 {int}."; - public String SetStats_set_atk_error = "无效的攻击力数值."; - public String SetStats_set_em = "元素精通设置为 {int}."; - public String SetStats_set_em_error = "无效的元素精通数值."; - public String SetStats_set_er = "元素充能设置为 {int}%."; - public String SetStats_set_er_error = "无效的元素充能数值."; - public String SetStats_set_cr = "暴击率设置为 {int}%."; - public String SetStats_set_cr_error = "无效的暴击率数值."; - public String SetStats_set_cd = "暴击伤害设置为 {int}%."; - public String SetStats_set_cd_error = "无效的暴击伤害数值."; - public String SetStats_set_pdb = "火伤设置为 {int}%."; - public String SetStats_set_pdb_error = "无效的火伤数值."; - public String SetStats_set_cdb = "冰伤设置为 {int}%."; - public String SetStats_set_cdb_error = "无效的冰伤数值."; - public String SetStats_set_hdb = "水伤设置为 {int}%."; - public String SetStats_set_hdb_error = "无效的水伤数值."; - public String SetStats_set_adb = "风伤设置为 {int}%."; - public String SetStats_set_adb_error = "无效的风伤数值."; - public String SetStats_set_gdb = "岩伤设置为 {int}%."; - public String SetStats_set_gdb_error = "无效的岩伤数值."; - public String SetStats_set_edb = "雷伤设置为 {int}%."; - public String SetStats_set_edb_error = "无效的雷伤数值."; - public String SetStats_set_physdb = "物伤设置为 {int}%."; - public String SetStats_set_physdb_error = "无效的物伤数值."; - public String SetStats_set_ddb = "草伤设置为 {int}%."; - public String SetStats_set_ddb_error = "无效的草伤数值."; - - // SetWorldLevel - public String SetWorldLevel_usage = "用法: setworldlevel "; - public String SetWorldLevel_world_level_must_between_0_and_8 = "世界等级必须在0-8之间。"; - public String SetWorldLevel_set_world_level = "世界等级已设置为 {level}."; - public String SetWorldLevel_invalid_world_level = "无效的世界等级."; - - // Spawn - public String Spawn_usage = "用法: spawn <实体ID|实体名> [数量] [等级(仅限怪物)]"; - public String Spawn_message = "已生成 {amount} 个 {id}."; - - // Stop - public String Stop_message = "正在关闭服务器..."; - - // Talent - public String Talent_usage_1 = "设置技能等级: /talent set <技能ID> <数值>"; - public String Talent_usage_2 = "另一种方式: /talent <数值>"; - public String Talent_usage_3 = "获取技能ID: /talent getid"; - public String Talent_lower_16 = "技能等级应低于16。"; - public String Talent_set_atk = "设置普通攻击等级为 {level}."; - public String Talent_set_e = "设置元素战技(e技能)等级为 {level}."; - public String Talent_set_q = "设置元素爆发(q技能)等级为 {level}."; - public String Talent_invalid_skill_id = "无效的技能ID。"; - public String Talent_set_this = "技能等级已设为 {level}."; - public String Talent_invalid_talent_level = "无效的技能等级。"; - public String Talent_normal_attack_id = "普通攻击技能ID {id}."; - public String Talent_e_skill_id = "元素战技(e技能)ID {id}."; - public String Talent_q_skill_id = "元素爆发(q技能)ID {id}."; - - // TeleportAll - public String TeleportAll_message = "此命令仅在多人游戏下可用。"; - - // Teleport - public String Teleport_usage_server = "用法: /tp @<玩家ID> [场景ID]"; - public String Teleport_usage = "用法: /tp @<玩家ID,不指定则为你自己> [场景ID]"; - public String Teleport_specify_player_id = "你必须指定一个玩家。"; - public String Teleport_invalid_position = "无效的位置。"; - public String Teleport_message = "已将 {name} 传送到场景 {id} ,坐标 {x},{y},{z}"; - - // Weather - public String Weather_usage = "用法: weather <天气ID> [气候ID]"; - public String Weather_message = "已修改天气为 {weatherId} 气候为 {climateId}"; - public String Weather_invalid_id = "无效的ID。"; -} diff --git a/src/main/java/emu/grasscutter/languages/Language.java b/src/main/java/emu/grasscutter/languages/Language.java deleted file mode 100644 index 53e99d24f..000000000 --- a/src/main/java/emu/grasscutter/languages/Language.java +++ /dev/null @@ -1,300 +0,0 @@ -package emu.grasscutter.languages; - -public final class Language { - public String An_error_occurred_during_game_update = "An error occurred during game update."; - public String Starting_Grasscutter = "Starting Grasscutter..."; - public String Invalid_server_run_mode = "Invalid server run mode."; - public String Server_run_mode = "Server run mode must be 'HYBRID', 'DISPATCH_ONLY', or 'GAME_ONLY'. Unable to start Grasscutter..."; - public String Shutting_down = "Shutting down..."; - public String Start_done = "Done! For help, type \"help\""; - public String Dispatch_mode_not_support_command = "Commands are not supported in dispatch only mode."; - public String Command_error = "Command error:"; - public String Error = "An error occurred."; - public String Grasscutter_is_free = "Grasscutter is FREE software. If you have paid for this, you may have been scammed. Homepage: https://github.com/Grasscutters/Grasscutter"; - public String Game_start_port = "Game Server started on port {port}"; - public String Client_connect = "Client connected from {address}"; - public String Client_disconnect = "Client disconnected from {address}"; - public String Client_request = "[Dispatch] Client {ip} {method} request: {url}"; - public String Not_load_keystore = "[Dispatch] Unable to load keystore. Trying default keystore password..."; - public String Use_default_keystore = "[Dispatch] The default keystore password was loaded successfully. Please consider setting the password to 123456 in config.json."; - public String Load_keystore_error = "[Dispatch] Error while loading keystore!"; - public String Not_find_ssl_cert = "[Dispatch] No SSL cert found! Falling back to HTTP server."; - public String Welcome = "Welcome to Grasscutter"; - public String Potential_unhandled_request = "[Dispatch] Potential unhandled {method} request: {url}"; - public String Client_try_login = "[Dispatch] Client {ip} is trying to log in"; - public String Client_login_token = "[Dispatch] Client {ip} is trying to log in via token"; - public String Client_token_login_failed = "[Dispatch] Client {ip} failed to log in via token"; - public String Client_login_in_token = "[Dispatch] Client {ip} logged in via token as {uid}"; - public String Game_account_cache_error = "Game account cache information error"; - public String Wrong_session_key = "Wrong session key."; - public String Client_exchange_combo_token = "[Dispatch] Client {ip} succeed to exchange combo token"; - public String Client_failed_exchange_combo_token = "[Dispatch] Client {ip} failed to exchange combo token"; - public String Dispatch_start_server_port = "[Dispatch] Dispatch server started on port {port}"; - public String Client_failed_login_account_create = "[Dispatch] Client {ip} failed to log in: Account {uid} created"; - public String Client_failed_login_account_create_failed = "[Dispatch] Client {ip} failed to log in: Account create failed"; - public String Client_failed_login_account_no_found = "[Dispatch] Client {ip} failed to log in: Account no found"; - public String Client_login = "[Dispatch] Client {ip} logged in as {uid}"; - public String Username_not_found = "Username not found."; - public String Username_not_found_create_failed = "Username not found, create failed."; - public String Create_resources_folder = "Creating resources folder..."; - public String Place_copy = "Place a copy of 'BinOutput' and 'ExcelBinOutput' in the resources folder."; - - // Command - public String No_command_specified = "No command specified."; - public String Unknown_command = "Unknown command: "; - public String You_not_permission_run_command = "You do not have permission to run this command."; - public String This_command_can_only_run_from_console = "This command can only be run from the console."; - public String Run_this_command_in_game = "Run this command in-game."; - public String Invalid_amount = "Invalid amount."; - public String Invalid_arguments = "Invalid arguments."; - public String Invalid_artifact_id = "Invalid artifact ID."; - public String Invalid_avatar_id = "Invalid avatar id."; - public String Invalid_avatar_level = "Invalid avatar level."; - public String Invalid_entity_id = "Invalid entity id."; - public String Invalid_item_id = "Invalid item id."; - public String Invalid_item_level = "Invalid item level."; - public String Invalid_item_refinement = "Invalid item refinement level."; - public String Invalid_playerId = "Invalid playerId."; - public String Invalid_UID = "Invalid UID."; - public String Player_not_found = "Player not found."; - public String Player_is_offline = "Player is offline."; - public String Enabled = "enabled"; - public String Disabled = "disabled"; - public String No_command_found = "No command found."; - public String Help = "Help"; - public String Player_not_found_or_offline = "Player not found or offline."; - public String Success = "Success"; - public String Target_cleared = "Target cleared."; - public String Target_set = "Subsequent commands will target @{uid} by default."; - public String Target_needed = "This command requires a target UID. Add a <@UID> argument or set a persistent target with /target @UID."; - - // Help - public String Help_usage = " Usage: "; - public String Help_aliases = " Aliases: "; - public String Help_available_command = "Available commands:"; - - // Account - public String Modify_user_account = "Modify user accounts"; - public String Account_exists = "Account already exists."; - public String Account_create_UID = "Account created with UID {uid}."; - public String Account_delete = "Account deleted."; - public String Account_not_find = "Account not found."; - public String Account_command_usage = "Usage: account [uid]"; - - // Broadcast - public String Broadcast_command_usage = "Usage: broadcast "; - public String Broadcast_message_sent = "Message sent."; - - // ChangeScene - public String Change_screen_usage = "Usage: changescene "; - public String Change_screen_you_in_that_screen = "You are already in that scene"; - public String Change_screen = "Changed to scene "; - public String Change_screen_not_exist = "Scene does not exist"; - - // Clear - public String Clear_usage = "Usage: clear "; - public String Clear_weapons = "Cleared weapons for {name} ."; - public String Clear_artifacts = "Cleared artifacts for {name} ."; - public String Clear_materials = "Cleared materials for {name} ."; - public String Clear_furniture = "Cleared furniture for {name} ."; - public String Clear_displays = "Cleared displays for {name} ."; - public String Clear_virtuals = "Cleared virtuals for {name} ."; - public String Clear_everything = "Cleared everything for {name} ."; - - // Coop - public String Coop_usage = "Usage: coop "; - public String Coop_success = "Summoned {target} to {host}'s world."; - - // Drop - public String Drop_usage = "Usage: drop [amount]"; - public String Drop_dropped_of = "Dropped {amount} of {item}."; - - // EnterDungeon - public String EnterDungeon_usage = "Usage: enterdungeon "; - public String EnterDungeon_changed_to_dungeon = "Changed to dungeon "; - public String EnterDungeon_dungeon_not_found = "Dungeon does not exist"; - public String EnterDungeon_you_in_that_dungeon = "You are already in that dungeon"; - - // GiveAll - public String GiveAll_usage = "Usage: giveall [amount]"; - public String GiveAll_item = "Giving all items..."; - public String GiveAll_done = "Giving all items done"; - - // GiveArtifact - public String GiveArtifact_usage = "Usage: giveart|gart [player] [[,]]... [level]"; - public String GiveArtifact_given = "Given {itemId} to {target}."; - - // GiveChar - public String GiveChar_usage = "Usage: givechar [amount]"; - public String GiveChar_given = "Given {avatarId} with level {level} to {target}."; - - // Give - public String Give_usage = "Usage: give [amount] [level]"; - public String Give_refinement_only_applicable_weapons = "Refinement is only applicable to weapons."; - public String Give_refinement_must_between_1_and_5 = "Refinement must be between 1 and 5."; - public String Give_given = "Given {amount} of {item} to {target}."; - public String Give_given_with_level_and_refinement = "Given {item} with level {lvl}, refinement {refinement} {amount} times to {target}"; - public String Give_given_level = "Given {item} with level {lvl} {amount} times to {target}"; - - // GodMode - public String Godmode_usage = "Usage: godmode [on|off|toggle]"; - public String Godmode_status = "Godmode is now {status} for {name}."; - - // Heal - public String Heal_message = "All characters have been healed."; - - // Kick - public String Kick_player_kick_player = "Player [{sendUid}:{sendName}] has kicked player [{kickUid}:{kickName}]"; - public String Kick_server_player = "Kicking player [{kickUid}:{kickName}]"; - - // Kill - public String Kill_usage = "Usage: killall [playerUid] [sceneId]"; - public String Kill_scene_not_found_in_player_world = "Scene not found in player world"; - public String Kill_kill_monsters_in_scene = "Killing {size} monsters in scene {id}"; - - // KillCharacter - public String KillCharacter_usage = "Usage: /killcharacter [playerId]"; - public String KillCharacter_kill_current_character = "Killed {name} current character."; - - // List - public String List_message = "There are {size} player(s) online:"; - - // Permission - public String Permission_usage = "Usage: permission "; - public String Permission_add = "Permission added."; - public String Permission_have_permission = "They already have this permission!"; - public String Permission_remove = "Permission removed."; - public String Permission_not_have_permission = "They don't have this permission!"; - - // Position - public String Position_message = "Coord: {x}, {y}, {z}\nScene id: {id}"; - - // Reload - public String Reload_reload_start = "Reloading config."; - public String Reload_reload_done = "Reload complete."; - - // ResetConst - public String ResetConst_reset_all = "Reset all avatars' constellations."; - public String ResetConst_reset_all_done = "Constellations for {name} have been reset. Please relog to see changes."; - - // ResetShopLimit - public String ResetShopLimit_usage = "Usage: /resetshop "; - - // SendMail - public String SendMail_usage = "Usage: give [player] [amount]"; - public String SendMail_user_not_exist = "The user with an id of '{id}' does not exist"; - public String SendMail_start_composition = "Starting composition of message.\nPlease use `/sendmail ` to continue.\nYou can use `/sendmail stop` at any time"; - public String SendMail_templates = "Mail templates coming soon implemented..."; - public String SendMail_invalid_arguments = "Invalid arguments.\nUsage `/sendmail <userId|all|help> [templateId]`"; - public String SendMail_send_cancel = "Message sending cancelled"; - public String SendMail_send_done = "Message sent to user {name}!"; - public String SendMail_send_all_done = "Message sent to all users!"; - public String SendMail_not_composition_end = "Message composition not at final stage.\nPlease use `/sendmail {args}` or `/sendmail stop` to cancel"; - public String SendMail_please_use = "Please use `/sendmail {args}`"; - public String SendMail_set_title = "Message title set as '{title}'.\nUse '/sendmail <content>' to continue."; - public String SendMail_set_contents = "Message contents set as '{contents}'.\nUse '/sendmail <sender>' to continue."; - public String SendMail_set_message_sender = "Message sender set as '{send}'.\nUse '/sendmail <itemId|itemName|finish> [amount] [level]' to continue."; - public String SendMail_send = "Attached {amount} of {item} (level {lvl}) to the message.\nContinue adding more items or use `/sendmail finish` to send the message."; - public String SendMail_invalid_arguments_please_use = "Invalid arguments \n Please use `/sendmail {args}`"; - public String SendMail_title = "<title>"; - public String SendMail_message = "<message>"; - public String SendMail_sender = "<sender>"; - public String SendMail_arguments = "<itemId|itemName|finish> [amount] [level]"; - public String SendMail_error = "ERROR: invalid construction stage {stage}. Check console for stacktrace."; - - // SendMessage - public String SendMessage_usage = "Usage: sendmessage <player> <message>"; - public String SenaMessage_message_sent = "Message sent."; - - // SetFetterLevel - public String SetFetterLevel_usage = "Usage: setfetterlevel <level>"; - public String SetFetterLevel_fetter_level_must_between_0_and_10 = "Fetter level must be between 0 and 10."; - public String SetFetterLevel_fetter_set_level = "Fetter level set to {level}"; - public String SetFetterLevel_invalid_fetter_level = "Invalid fetter level."; - - // SetStats - public String SetStats_usage_console = "Usage: setstats|stats @<UID> <stat> <value>"; - public String SetStats_usage_ingame = "Usage: setstats|stats [@UID] <stat> <value>"; - public String SetStats_help_message = """ - \n\tValues for <stat>: hp | maxhp | def | atk | em | er | crate | cdmg | cdr | heal | heali | shield | defi - \t(cont.) Elemental DMG Bonus: epyro | ecryo | ehydro | egeo | edendro | eelectro | ephys - \t(cont.) Elemental RES: respyro | rescryo | reshydro | resgeo | resdendro | reselectro | resphys - """; - public String SetStats_value_error = "Invalid stat value."; - public String SetStats_set_self = "{name} set to {value}."; - public String SetStats_set_for_uid = "{name} for {uid} set to {value}."; - public String Stats_FIGHT_PROP_MAX_HP = "Max HP"; - public String Stats_FIGHT_PROP_CUR_HP = "Current HP"; - public String Stats_FIGHT_PROP_CUR_ATTACK = "ATK"; - public String Stats_FIGHT_PROP_BASE_ATTACK = "Base ATK"; - public String Stats_FIGHT_PROP_DEFENSE = "DEF"; - public String Stats_FIGHT_PROP_ELEMENT_MASTERY = "Elemental Mastery"; - public String Stats_FIGHT_PROP_CHARGE_EFFICIENCY = "Energy Recharge"; - public String Stats_FIGHT_PROP_CRITICAL = "Crit Rate"; - public String Stats_FIGHT_PROP_CRITICAL_HURT = "Crit DMG"; - public String Stats_FIGHT_PROP_ADD_HURT = "DMG Bonus"; - public String Stats_FIGHT_PROP_WIND_ADD_HURT = "Anemo DMG Bonus"; - public String Stats_FIGHT_PROP_ICE_ADD_HURT = "Cryo DMG Bonus"; - public String Stats_FIGHT_PROP_GRASS_ADD_HURT = "Dendro DMG Bonus"; - public String Stats_FIGHT_PROP_ELEC_ADD_HURT = "Electro DMG Bonus"; - public String Stats_FIGHT_PROP_ROCK_ADD_HURT = "Geo DMG Bonus"; - public String Stats_FIGHT_PROP_WATER_ADD_HURT = "Hydro DMG Bonus"; - public String Stats_FIGHT_PROP_FIRE_ADD_HURT = "Pyro DMG Bonus"; - public String Stats_FIGHT_PROP_PHYSICAL_ADD_HURT = "Physical DMG Bonus"; - public String Stats_FIGHT_PROP_SUB_HURT = "DMG Reduction"; - public String Stats_FIGHT_PROP_WIND_SUB_HURT = "Anemo RES"; - public String Stats_FIGHT_PROP_ICE_SUB_HURT = "Cryo RES"; - public String Stats_FIGHT_PROP_GRASS_SUB_HURT = "Dendro RES"; - public String Stats_FIGHT_PROP_ELEC_SUB_HURT = "Electro RES"; - public String Stats_FIGHT_PROP_ROCK_SUB_HURT = "Geo RES"; - public String Stats_FIGHT_PROP_WATER_SUB_HURT = "Hydro RES"; - public String Stats_FIGHT_PROP_FIRE_SUB_HURT = "Pyro RES"; - public String Stats_FIGHT_PROP_PHYSICAL_SUB_HURT = "Physical RES"; - public String Stats_FIGHT_PROP_SKILL_CD_MINUS_RATIO = "Cooldown Reduction"; - public String Stats_FIGHT_PROP_HEAL_ADD = "Healing Bonus"; - public String Stats_FIGHT_PROP_HEALED_ADD = "Incoming Healing Bonus"; - public String Stats_FIGHT_PROP_SHIELD_COST_MINUS_RATIO = "Shield Strength"; - public String Stats_FIGHT_PROP_DEFENCE_IGNORE_RATIO = "DEF Ignore"; - - // SetWorldLevel - public String SetWorldLevel_usage = "Usage: setworldlevel <level>"; - public String SetWorldLevel_world_level_must_between_0_and_8 = "World level must be between 0-8"; - public String SetWorldLevel_set_world_level = "World level set to {level}."; - public String SetWorldLevel_invalid_world_level = "Invalid world level."; - - // Spawn - public String Spawn_usage = "Usage: spawn <entityId> [amount] [level(monster only)]"; - public String Spawn_message = "Spawned {amount} of {id}."; - - // Stop - public String Stop_message = "Server shutting down..."; - - // Talent - public String Talent_usage_1 = "To set talent level: /talent set <talentID> <value>"; - public String Talent_usage_2 = "Another way to set talent level: /talent <n or e or q> <value>"; - public String Talent_usage_3 = "To get talent ID: /talent getid"; - public String Talent_lower_16 = "Invalid talent level. Level should be lower than 16"; - public String Talent_set_id = "Set talent {id} to {level}."; - public String Talent_set_atk = "Set talent Normal ATK to {level}."; - public String Talent_set_e = "Set talent E to {level}."; - public String Talent_set_q = "Set talent Q to {level}."; - public String Talent_invalid_skill_id = "Invalid skill ID."; - public String Talent_set_this = "Set this talent to {level}."; - public String Talent_invalid_talent_level = "Invalid talent level."; - public String Talent_normal_attack_id = "Normal Attack ID {id}."; - public String Talent_e_skill_id = "E skill ID {id}."; - public String Talent_q_skill_id = "Q skill ID {id}."; - - // TeleportAll - public String TeleportAll_message = "You only can use this command in MP mode."; - - // Teleport - public String Teleport_usage = "Usage: /tp <x> <y> <z> [scene id]"; - public String Teleport_invalid_position = "Invalid position."; - public String Teleport_message = "Teleported {name} to {x},{y},{z} in scene {id}"; - - // Weather - public String Weather_usage = "Usage: weather <weatherId> [climateId]"; - public String Weather_message = "Changed weather to {weatherId} with climate {climateId}"; - public String Weather_invalid_id = "Invalid ID."; -} diff --git a/src/main/java/emu/grasscutter/plugin/api/README.md b/src/main/java/emu/grasscutter/plugin/api/README.md deleted file mode 100644 index 73a5a75ee..000000000 --- a/src/main/java/emu/grasscutter/plugin/api/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# Grasscutter Plugin API -**Warning!** As of now, this is a work in progress and isn't completely documented. \ No newline at end of file diff --git a/src/main/java/emu/grasscutter/utils/Language.java b/src/main/java/emu/grasscutter/utils/Language.java new file mode 100644 index 000000000..702da202a --- /dev/null +++ b/src/main/java/emu/grasscutter/utils/Language.java @@ -0,0 +1,82 @@ +package emu.grasscutter.utils; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import emu.grasscutter.Grasscutter; + +import javax.annotation.Nullable; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +public final class Language { + private final JsonObject languageData; + private final Map<String, String> cachedTranslations = new HashMap<>(); + + /** + * Creates a language instance from a code. + * @param langCode The language code. + * @return A language instance. + */ + public static Language getLanguage(String langCode) { + return new Language(langCode + ".json"); + } + + /** + * Returns the translated value from the key while substituting arguments. + * @param key The key of the translated value to return. + * @param args The arguments to substitute. + * @return A translated value with arguments substituted. + */ + public static String translate(String key, Object... args) { + return Grasscutter.getLanguage().get(key).formatted(args); + } + + /** + * Reads a file and creates a language instance. + * @param fileName The name of the language file. + */ + private Language(String fileName) { + @Nullable JsonObject languageData = null; + + try { + InputStream file = Grasscutter.class.getResourceAsStream("/lang/" + fileName); + languageData = Grasscutter.getGsonFactory().fromJson(Utils.readFromInputStream(file), JsonObject.class); + } catch (Exception exception) { + Grasscutter.getLogger().error("Failed to load language file: " + fileName, exception); + } this.languageData = languageData; + } + + /** + * Returns the value (as a string) from a nested key. + * @param key The key to look for. + * @return The value (as a string) from a nested key. + */ + public String get(String key) { + if(this.cachedTranslations.containsKey(key)) { + return this.cachedTranslations.get(key); + } + + String[] keys = key.split("\\."); + JsonObject object = this.languageData; + + int index = 0; + String result = ""; + + while (true) { + if(index == keys.length) break; + + String currentKey = keys[index++]; + if(object.has(currentKey)) { + JsonElement element = object.get(currentKey); + if(element.isJsonObject()) + object = element.getAsJsonObject(); + else { + result = element.getAsString(); break; + } + } else break; + } + + this.cachedTranslations.put(key, result); return result; + } +} From c0b1ec1b9eaa14e7f597d2d043b8c6b0ea3f0734 Mon Sep 17 00:00:00 2001 From: KingRainbow44 <kobedo11@gmail.com> Date: Fri, 6 May 2022 00:57:45 -0400 Subject: [PATCH 07/39] Convert to the superior language system. (pt. 2) --- .gitignore | 4 +- src/main/java/emu/grasscutter/Config.java | 1 - .../emu/grasscutter/command/CommandMap.java | 57 ++-- .../command/commands/AccountCommand.java | 19 +- .../command/commands/BroadcastCommand.java | 6 +- .../command/commands/ChangeSceneCommand.java | 16 +- .../command/commands/ClearCommand.java | 36 ++- .../command/commands/CoopCommand.java | 2 +- .../command/commands/DropCommand.java | 16 +- .../command/commands/EnterDungeonCommand.java | 16 +- .../command/commands/GiveAllCommand.java | 2 +- .../command/commands/GiveArtifactCommand.java | 2 +- .../command/commands/GiveCharCommand.java | 16 +- .../command/commands/GiveCommand.java | 28 +- .../command/commands/GodModeCommand.java | 8 +- .../command/commands/HealCommand.java | 7 +- .../command/commands/HelpCommand.java | 22 +- .../command/commands/KickCommand.java | 11 +- .../command/commands/KillAllCommand.java | 14 +- .../commands/KillCharacterCommand.java | 2 +- .../command/commands/PermissionCommand.java | 4 +- .../command/commands/PositionCommand.java | 9 +- .../command/commands/ReloadCommand.java | 8 +- .../command/commands/ResetConstCommand.java | 9 +- .../commands/ResetShopLimitCommand.java | 2 +- .../command/commands/SendMailCommand.java | 67 ++-- .../command/commands/SendMessageCommand.java | 4 +- .../commands/SetFetterLevelCommand.java | 2 +- .../command/commands/SetStatsCommand.java | 106 +++---- .../commands/SetWorldLevelCommand.java | 2 +- .../command/commands/SpawnCommand.java | 2 +- .../command/commands/TalentCommand.java | 88 +++--- .../command/commands/TeleportAllCommand.java | 2 +- .../command/commands/TeleportCommand.java | 2 +- .../command/commands/WeatherCommand.java | 2 +- .../grasscutter/game/shop/ShopManager.java | 12 +- .../grasscutter/plugin/api/PlayerHook.java | 1 + .../dispatch/DispatchHttpJsonHandler.java | 7 +- .../server/dispatch/DispatchServer.java | 32 +- .../grasscutter/server/game/GameServer.java | 15 +- .../grasscutter/server/game/GameSession.java | 12 +- .../java/emu/grasscutter/tools/Tools.java | 3 + .../java/emu/grasscutter/utils/Utils.java | 50 ++- src/main/resources/languages/en_US.json | 295 ++++++++++++++++++ 44 files changed, 687 insertions(+), 334 deletions(-) create mode 100644 src/main/resources/languages/en_US.json diff --git a/.gitignore b/.gitignore index 239309c12..32987345b 100644 --- a/.gitignore +++ b/.gitignore @@ -64,6 +64,4 @@ mitmdump.exe !lib/*.jar mongod.exe /src/generated/ -/*.sh -language/ -languages/ +/*.sh \ No newline at end of file diff --git a/src/main/java/emu/grasscutter/Config.java b/src/main/java/emu/grasscutter/Config.java index dd24ac8a0..cf0a54a43 100644 --- a/src/main/java/emu/grasscutter/Config.java +++ b/src/main/java/emu/grasscutter/Config.java @@ -6,7 +6,6 @@ import emu.grasscutter.Grasscutter.ServerRunMode; import emu.grasscutter.game.mail.Mail; public final class Config { - public String DatabaseUrl = "mongodb://localhost:27017"; public String DatabaseCollection = "grasscutter"; diff --git a/src/main/java/emu/grasscutter/command/CommandMap.java b/src/main/java/emu/grasscutter/command/CommandMap.java index f17fb0443..07deb84fd 100644 --- a/src/main/java/emu/grasscutter/command/CommandMap.java +++ b/src/main/java/emu/grasscutter/command/CommandMap.java @@ -8,6 +8,8 @@ import org.reflections.Reflections; import java.util.*; +import static emu.grasscutter.utils.Language.translate; + @SuppressWarnings({"UnusedReturnValue", "unused"}) public final class CommandMap { private final Map<String, CommandHandler> commands = new HashMap<>(); @@ -109,7 +111,7 @@ public final class CommandMap { public void invoke(Player player, Player targetPlayer, String rawMessage) { rawMessage = rawMessage.trim(); if (rawMessage.length() == 0) { - CommandHandler.sendMessage(player, Grasscutter.getLanguage().No_command_specified); + CommandHandler.sendMessage(player, translate("commands.generic.not_specified")); return; } @@ -118,11 +120,12 @@ public final class CommandMap { List<String> args = new LinkedList<>(Arrays.asList(split)); String label = args.remove(0); String playerId = (player == null) ? consoleId : player.getAccount().getId(); - // Check for special cases - currently only target command + + // Check for special cases - currently only target command. String targetUidStr = null; - if (label.startsWith("@")) { // @[UID] + if (label.startsWith("@")) { // @[UID] targetUidStr = label.substring(1); - } else if (label.equalsIgnoreCase("target")) { // target [[@]UID] + } else if (label.equalsIgnoreCase("target")) { // target [[@]UID] if (args.size() > 0) { targetUidStr = args.get(0); if (targetUidStr.startsWith("@")) { @@ -133,68 +136,64 @@ public final class CommandMap { } } if (targetUidStr != null) { - if (targetUidStr.equals("")) { // Clears default targetPlayer + if (targetUidStr.equals("")) { // Clears the default targetPlayer. targetPlayerIds.remove(playerId); - CommandHandler.sendMessage(player, Grasscutter.getLanguage().Target_cleared); - return; - } else { // Sets default targetPlayer to the UID given + CommandHandler.sendMessage(player, translate("commands.execution.clear_target")); + } else { // Sets default targetPlayer to the UID provided. try { int uid = Integer.parseInt(targetUidStr); targetPlayer = Grasscutter.getGameServer().getPlayerByUid(uid); if (targetPlayer == null) { - CommandHandler.sendMessage(player, Grasscutter.getLanguage().Player_not_found_or_offline); + CommandHandler.sendMessage(player, translate("commands.generic.execution.player_exist_offline_error")); } else { targetPlayerIds.put(playerId, uid); - CommandHandler.sendMessage(player, Grasscutter.getLanguage().Target_set.replace("{uid}", targetUidStr)); + CommandHandler.sendMessage(player, translate("commands.execution.set_target", targetUidStr)); } } catch (NumberFormatException e) { - CommandHandler.sendMessage(player, Grasscutter.getLanguage().Invalid_UID); + CommandHandler.sendMessage(player, translate("commands.execution.uid_error")); } - return; } + return; } // Get command handler. CommandHandler handler = this.commands.get(label); if (handler == null) { - CommandHandler.sendMessage(player, Grasscutter.getLanguage().Unknown_command + label); + CommandHandler.sendMessage(player, translate("commands.generic.unknown_command", label)); return; } - // If any @UID argument is present, override targetPlayer with it + // If any @UID argument is present, override targetPlayer with it. for (int i = 0; i < args.size(); i++) { String arg = args.get(i); - if (!arg.startsWith("@")) { - continue; - } else { + if (arg.startsWith("@")) { arg = args.remove(i).substring(1); try { int uid = Integer.parseInt(arg); targetPlayer = Grasscutter.getGameServer().getPlayerByUid(uid); if (targetPlayer == null) { - CommandHandler.sendMessage(player, Grasscutter.getLanguage().Player_not_found_or_offline); + CommandHandler.sendMessage(player, translate("commands.generic.execution.player_exist_offline_error")); return; } break; } catch (NumberFormatException e) { - CommandHandler.sendMessage(player, Grasscutter.getLanguage().Invalid_UID); + CommandHandler.sendMessage(player, translate("commands.execution.uid_error")); return; } } } + // If there's still no targetPlayer at this point, use previously-set target if (targetPlayer == null) { if (targetPlayerIds.containsKey(playerId)) { targetPlayer = Grasscutter.getGameServer().getPlayerByUid(targetPlayerIds.get(playerId)); // We check every time in case the target goes offline after being targeted if (targetPlayer == null) { - CommandHandler.sendMessage(player, Grasscutter.getLanguage().Player_not_found_or_offline); + CommandHandler.sendMessage(player, translate("commands.generic.execution.player_exist_offline_error")); return; } } else { - // If there's still no targetPlayer at this point, use local player - if (targetPlayer == null) { - targetPlayer = player; - } + // If there's still no targetPlayer at this point, use executor. + targetPlayer = player; } } @@ -205,12 +204,12 @@ public final class CommandMap { Account account = player.getAccount(); if (player != targetPlayer) { // Additional permission required for targeting another player if (!permissionNodeTargeted.isEmpty() && !account.hasPermission(permissionNodeTargeted)) { - CommandHandler.sendMessage(player, Grasscutter.getLanguage().You_not_permission_run_command); + CommandHandler.sendMessage(player, translate("commands.generic.permission_error")); return; } } if (!permissionNode.isEmpty() && !account.hasPermission(permissionNode)) { - CommandHandler.sendMessage(player, Grasscutter.getLanguage().You_not_permission_run_command); + CommandHandler.sendMessage(player, translate("commands.generic.permission_error")); return; } } @@ -220,10 +219,8 @@ public final class CommandMap { final Player targetPlayerF = targetPlayer; // Is there a better way to do this? Runnable runnable = () -> handler.execute(player, targetPlayerF, args); if(threading) { - Thread command = new Thread(runnable); - command.start(); - } - else { + new Thread(runnable).start(); + } else { runnable.run(); } } diff --git a/src/main/java/emu/grasscutter/command/commands/AccountCommand.java b/src/main/java/emu/grasscutter/command/commands/AccountCommand.java index a26e52ff0..627f4680f 100644 --- a/src/main/java/emu/grasscutter/command/commands/AccountCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/AccountCommand.java @@ -1,6 +1,5 @@ package emu.grasscutter.command.commands; -import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; import emu.grasscutter.database.DatabaseHelper; @@ -8,18 +7,20 @@ import emu.grasscutter.game.player.Player; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "account", usage = "account <create|delete> <username> [uid]", description = "Modify user accounts") public final class AccountCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (sender != null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().This_command_can_only_run_from_console); + CommandHandler.sendMessage(sender, translate("commands.generic.console_execute_error")); return; } if (args.size() < 2) { - CommandHandler.sendMessage(null, Grasscutter.getLanguage().Account_command_usage); + CommandHandler.sendMessage(null, translate("commands.account.command_usage")); return; } @@ -28,7 +29,7 @@ public final class AccountCommand implements CommandHandler { switch (action) { default: - CommandHandler.sendMessage(null, Grasscutter.getLanguage().Account_command_usage); + CommandHandler.sendMessage(null, translate("commands.account.command_usage")); return; case "create": int uid = 0; @@ -36,27 +37,27 @@ public final class AccountCommand implements CommandHandler { try { uid = Integer.parseInt(args.get(2)); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(null, Grasscutter.getLanguage().Invalid_UID); + CommandHandler.sendMessage(null, translate("commands.account.invalid")); return; } } emu.grasscutter.game.Account account = DatabaseHelper.createAccountWithId(username, uid); if (account == null) { - CommandHandler.sendMessage(null, Grasscutter.getLanguage().Account_exists); + CommandHandler.sendMessage(null, translate("commands.account.exists")); return; } else { account.addPermission("*"); account.save(); // Save account to database. - CommandHandler.sendMessage(null, Grasscutter.getLanguage().Account_create_UID.replace("{uid}", Integer.toString(account.getPlayerUid()))); + CommandHandler.sendMessage(null, translate("commands.account.create", Integer.toString(account.getPlayerUid()))); } return; case "delete": if (DatabaseHelper.deleteAccount(username)) { - CommandHandler.sendMessage(null, Grasscutter.getLanguage().Account_delete); + CommandHandler.sendMessage(null, translate("commands.account.delete")); } else { - CommandHandler.sendMessage(null, Grasscutter.getLanguage().Account_not_find); + CommandHandler.sendMessage(null, translate("commands.account.no_account")); } } } diff --git a/src/main/java/emu/grasscutter/command/commands/BroadcastCommand.java b/src/main/java/emu/grasscutter/command/commands/BroadcastCommand.java index b6eeac422..1aa234919 100644 --- a/src/main/java/emu/grasscutter/command/commands/BroadcastCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/BroadcastCommand.java @@ -7,6 +7,8 @@ import emu.grasscutter.game.player.Player; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "broadcast", usage = "broadcast <message>", description = "Sends a message to all the players", aliases = {"b"}, permission = "server.broadcast") public final class BroadcastCommand implements CommandHandler { @@ -14,7 +16,7 @@ public final class BroadcastCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (args.size() < 1) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Broadcast_command_usage); + CommandHandler.sendMessage(sender, translate("commands.broadcast.command_usage")); return; } @@ -24,6 +26,6 @@ public final class BroadcastCommand implements CommandHandler { CommandHandler.sendMessage(p, message); } - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Broadcast_message_sent); + CommandHandler.sendMessage(sender, translate("commands.broadcast.message_sent")); } } diff --git a/src/main/java/emu/grasscutter/command/commands/ChangeSceneCommand.java b/src/main/java/emu/grasscutter/command/commands/ChangeSceneCommand.java index fb1694325..1a4e97927 100644 --- a/src/main/java/emu/grasscutter/command/commands/ChangeSceneCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/ChangeSceneCommand.java @@ -1,43 +1,43 @@ package emu.grasscutter.command.commands; -import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; import emu.grasscutter.game.player.Player; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "changescene", usage = "changescene <scene id>", description = "Changes your scene", aliases = {"scene"}, permission = "player.changescene") public final class ChangeSceneCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } if (args.size() != 1) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Change_screen_usage); + CommandHandler.sendMessage(sender, translate("commands.changescene.usage")); return; } try { int sceneId = Integer.parseInt(args.get(0)); - if (sceneId == targetPlayer.getSceneId()) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Change_screen_you_in_that_screen); + CommandHandler.sendMessage(sender, translate("commands.changescene.already_in_scene")); return; } boolean result = targetPlayer.getWorld().transferPlayerToScene(targetPlayer, sceneId, targetPlayer.getPos()); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Change_screen + sceneId); + CommandHandler.sendMessage(sender, translate("commands.changescene.result", Integer.toString(sceneId))); if (!result) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Change_screen_not_exist); + CommandHandler.sendMessage(sender, translate("commands.changescene.exists_error")); } } catch (Exception e) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_arguments); + CommandHandler.sendMessage(sender, translate("commands.execution.argument_error")); } } } diff --git a/src/main/java/emu/grasscutter/command/commands/ClearCommand.java b/src/main/java/emu/grasscutter/command/commands/ClearCommand.java index 2d0d0c48a..47d9f2c0d 100644 --- a/src/main/java/emu/grasscutter/command/commands/ClearCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/ClearCommand.java @@ -10,6 +10,8 @@ import emu.grasscutter.game.player.Player; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "clear", usage = "clear <all|wp|art|mat>", //Merged /clearartifacts and /clearweapons to /clear <args> [uid] description = "Deletes unequipped unlocked items, including yellow rarity ones from your inventory", aliases = {"clear"}, permission = "player.clearinv") @@ -19,11 +21,11 @@ public final class ClearCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } if (args.size() < 1) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Clear_usage); + CommandHandler.sendMessage(sender, translate("commands.clear.command_usage")); return; } Inventory playerInventory = targetPlayer.getInventory(); @@ -35,7 +37,7 @@ public final class ClearCommand implements CommandHandler { .filter(item -> item.getItemType() == ItemType.ITEM_WEAPON) .filter(item -> !item.isLocked() && !item.isEquipped()) .toList(); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Clear_weapons.replace("{name}", targetPlayer.getNickname())); + CommandHandler.sendMessage(sender, translate("commands.clear.weapons", targetPlayer.getNickname())); } case "art" -> { toDelete = playerInventory.getItems().values().stream() @@ -43,7 +45,7 @@ public final class ClearCommand implements CommandHandler { .filter(item -> item.getLevel() == 1 && item.getExp() == 0) .filter(item -> !item.isLocked() && !item.isEquipped()) .toList(); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Clear_artifacts.replace("{name}", targetPlayer.getNickname())); + CommandHandler.sendMessage(sender, translate("commands.clear.artifacts", targetPlayer.getNickname())); } case "mat" -> { toDelete = playerInventory.getItems().values().stream() @@ -51,7 +53,7 @@ public final class ClearCommand implements CommandHandler { .filter(item -> item.getLevel() == 1 && item.getExp() == 0) .filter(item -> !item.isLocked() && !item.isEquipped()) .toList(); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Clear_artifacts.replace("{name}", targetPlayer.getNickname())); + CommandHandler.sendMessage(sender, translate("commands.clear.materials", targetPlayer.getNickname())); } case "all" -> { toDelete = playerInventory.getItems().values().stream() @@ -59,34 +61,44 @@ public final class ClearCommand implements CommandHandler { .filter(item1 -> item1.getLevel() == 1 && item1.getExp() == 0) .filter(item1 -> !item1.isLocked() && !item1.isEquipped()) .toList(); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Clear_artifacts.replace("{name}", targetPlayer.getNickname())); + CommandHandler.sendMessage(sender, translate("commands.clear.artifacts", targetPlayer.getNickname())); + playerInventory.removeItems(toDelete); + toDelete = playerInventory.getItems().values().stream() .filter(item2 -> item2.getItemType() == ItemType.ITEM_MATERIAL) .filter(item2 -> !item2.isLocked() && !item2.isEquipped()) .toList(); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Clear_artifacts.replace("{name}", targetPlayer.getNickname())); + playerInventory.removeItems(toDelete); + CommandHandler.sendMessage(sender, translate("commands.clear.materials", targetPlayer.getNickname())); + toDelete = playerInventory.getItems().values().stream() .filter(item3 -> item3.getItemType() == ItemType.ITEM_WEAPON) .filter(item3 -> item3.getLevel() == 1 && item3.getExp() == 0) .filter(item3 -> !item3.isLocked() && !item3.isEquipped()) .toList(); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Clear_artifacts.replace("{name}", targetPlayer.getNickname())); + playerInventory.removeItems(toDelete); + CommandHandler.sendMessage(sender, translate("commands.clear.weapons", targetPlayer.getNickname())); + toDelete = playerInventory.getItems().values().stream() .filter(item4 -> item4.getItemType() == ItemType.ITEM_FURNITURE) .filter(item4 -> !item4.isLocked() && !item4.isEquipped()) .toList(); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Clear_furniture.replace("{name}", targetPlayer.getNickname())); + playerInventory.removeItems(toDelete); + CommandHandler.sendMessage(sender, translate("commands.clear.furniture", targetPlayer.getNickname())); + toDelete = playerInventory.getItems().values().stream() .filter(item5 -> item5.getItemType() == ItemType.ITEM_DISPLAY) .filter(item5 -> !item5.isLocked() && !item5.isEquipped()) .toList(); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Clear_displays.replace("{name}", targetPlayer.getNickname())); + playerInventory.removeItems(toDelete); + CommandHandler.sendMessage(sender, translate("commands.clear.displays", targetPlayer.getNickname())); + toDelete = playerInventory.getItems().values().stream() .filter(item6 -> item6.getItemType() == ItemType.ITEM_VIRTUAL) .filter(item6 -> !item6.isLocked() && !item6.isEquipped()) .toList(); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Clear_virtuals.replace("{name}", targetPlayer.getNickname())); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Clear_everything.replace("{name}", targetPlayer.getNickname())); + CommandHandler.sendMessage(sender, translate("commands.clear.virtuals", targetPlayer.getNickname())); + CommandHandler.sendMessage(sender, translate("commands.clear.everything", targetPlayer.getNickname())); } } diff --git a/src/main/java/emu/grasscutter/command/commands/CoopCommand.java b/src/main/java/emu/grasscutter/command/commands/CoopCommand.java index fff548d95..d41805c82 100644 --- a/src/main/java/emu/grasscutter/command/commands/CoopCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/CoopCommand.java @@ -13,7 +13,7 @@ public final class CoopCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } diff --git a/src/main/java/emu/grasscutter/command/commands/DropCommand.java b/src/main/java/emu/grasscutter/command/commands/DropCommand.java index 29c5f10c6..a33a32603 100644 --- a/src/main/java/emu/grasscutter/command/commands/DropCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/DropCommand.java @@ -11,6 +11,8 @@ import emu.grasscutter.utils.Position; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "drop", usage = "drop <itemId|itemName> [amount]", description = "Drops an item near you", aliases = {"d", "dropitem"}, permission = "server.drop") public final class DropCommand implements CommandHandler { @@ -18,7 +20,7 @@ public final class DropCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(null, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(null, translate("commands.execution.need_target")); return; } @@ -30,25 +32,25 @@ public final class DropCommand implements CommandHandler { try { amount = Integer.parseInt(args.get(1)); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_amount); + CommandHandler.sendMessage(sender, translate("commands.generic.invalid.amount")); return; - } // Slightly cheeky here: no break so it falls through to initialize the first argument too + } // Slightly cheeky here: no break, so it falls through to initialize the first argument too case 1: try { item = Integer.parseInt(args.get(0)); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_item_id); + CommandHandler.sendMessage(sender, translate("commands.generic.invalid.itemId")); return; } break; default: - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Drop_usage); + CommandHandler.sendMessage(sender, translate("commands.drop.command_usage")); return; } ItemData itemData = GameData.getItemDataMap().get(item); if (itemData == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_item_id); + CommandHandler.sendMessage(sender, translate("commands.generic.invalid.itemId")); return; } if (itemData.isEquip()) { @@ -62,6 +64,6 @@ public final class DropCommand implements CommandHandler { EntityItem entity = new EntityItem(targetPlayer.getScene(), targetPlayer, itemData, targetPlayer.getPos().clone().addY(3f), amount); targetPlayer.getScene().addEntity(entity); } - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Drop_dropped_of.replace("{amount}", Integer.toString(amount)).replace("{item}", Integer.toString(item))); + CommandHandler.sendMessage(sender, translate("commands.drop.success", Integer.toString(amount), Integer.toString(item))); } } \ No newline at end of file diff --git a/src/main/java/emu/grasscutter/command/commands/EnterDungeonCommand.java b/src/main/java/emu/grasscutter/command/commands/EnterDungeonCommand.java index a52787b68..434e80c8f 100644 --- a/src/main/java/emu/grasscutter/command/commands/EnterDungeonCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/EnterDungeonCommand.java @@ -1,43 +1,43 @@ package emu.grasscutter.command.commands; -import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; import emu.grasscutter.game.player.Player; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "enterdungeon", usage = "enterdungeon <dungeon id>", description = "Enter a dungeon", aliases = {"dungeon"}, permission = "player.enterdungeon") public final class EnterDungeonCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(null, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(null, translate("commands.execution.need_target")); return; } if (args.size() < 1) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().EnterDungeon_usage); + CommandHandler.sendMessage(sender, translate("commands.enter_dungeon.usage")); return; } try { int dungeonId = Integer.parseInt(args.get(0)); - if (dungeonId == targetPlayer.getSceneId()) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().EnterDungeon_you_in_that_dungeon); + CommandHandler.sendMessage(sender, translate("commands.enter_dungeon.in_dungeon_error")); return; } boolean result = targetPlayer.getServer().getDungeonManager().enterDungeon(targetPlayer.getSession().getPlayer(), 0, dungeonId); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().EnterDungeon_changed_to_dungeon + dungeonId); + CommandHandler.sendMessage(sender, translate("commands.enter_dungeon.changed", dungeonId)); if (!result) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().EnterDungeon_dungeon_not_found); + CommandHandler.sendMessage(sender, translate("commands.enter_dungeon.not_found_error")); } } catch (Exception e) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().EnterDungeon_usage); + CommandHandler.sendMessage(sender, translate("commands.enter_dungeon.usage")); } } } diff --git a/src/main/java/emu/grasscutter/command/commands/GiveAllCommand.java b/src/main/java/emu/grasscutter/command/commands/GiveAllCommand.java index 21352dba5..ea249af9e 100644 --- a/src/main/java/emu/grasscutter/command/commands/GiveAllCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/GiveAllCommand.java @@ -20,7 +20,7 @@ public final class GiveAllCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } int amount = 99999; diff --git a/src/main/java/emu/grasscutter/command/commands/GiveArtifactCommand.java b/src/main/java/emu/grasscutter/command/commands/GiveArtifactCommand.java index 4d123dc5a..5b8351a5a 100644 --- a/src/main/java/emu/grasscutter/command/commands/GiveArtifactCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/GiveArtifactCommand.java @@ -19,7 +19,7 @@ public final class GiveArtifactCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } diff --git a/src/main/java/emu/grasscutter/command/commands/GiveCharCommand.java b/src/main/java/emu/grasscutter/command/commands/GiveCharCommand.java index 6283a8e78..87c2d61e2 100644 --- a/src/main/java/emu/grasscutter/command/commands/GiveCharCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/GiveCharCommand.java @@ -10,6 +10,8 @@ import emu.grasscutter.game.player.Player; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "givechar", usage = "givechar <avatarId> [level]", description = "Gives the player a specified character", aliases = {"givec"}, permission = "player.givechar") public final class GiveCharCommand implements CommandHandler { @@ -17,7 +19,7 @@ public final class GiveCharCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } @@ -30,7 +32,7 @@ public final class GiveCharCommand implements CommandHandler { level = Integer.parseInt(args.get(1)); } catch (NumberFormatException ignored) { // TODO: Parse from avatar name using GM Handbook. - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_avatar_level); + CommandHandler.sendMessage(sender, translate("commands.execution.invalid.avatarLevel")); return; } // Cheeky fall-through to parse first argument too case 1: @@ -38,24 +40,24 @@ public final class GiveCharCommand implements CommandHandler { avatarId = Integer.parseInt(args.get(0)); } catch (NumberFormatException ignored) { // TODO: Parse from avatar name using GM Handbook. - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_avatar_id); + CommandHandler.sendMessage(sender, translate("commands.execution.invalid.avatarId")); return; } break; default: - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().GiveChar_usage); + CommandHandler.sendMessage(sender, translate("commands.giveChar.usage")); return; } AvatarData avatarData = GameData.getAvatarDataMap().get(avatarId); if (avatarData == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_avatar_id); + CommandHandler.sendMessage(sender, translate("commands.execution.invalid.avatarId")); return; } // Check level. if (level > 90) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_avatar_level); + CommandHandler.sendMessage(sender, translate("commands.execution.invalid.avatarLevel")); return; } @@ -75,6 +77,6 @@ public final class GiveCharCommand implements CommandHandler { avatar.recalcStats(); targetPlayer.addAvatar(avatar); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().GiveChar_given.replace("{avatarId}", Integer.toString(avatarId)).replace("{level}", Integer.toString(level)).replace("{target}", Integer.toString(targetPlayer.getUid()))); + CommandHandler.sendMessage(sender, translate("commands.execution.giveChar.given", Integer.toString(avatarId), Integer.toString(level), Integer.toString(targetPlayer.getUid()))); } } diff --git a/src/main/java/emu/grasscutter/command/commands/GiveCommand.java b/src/main/java/emu/grasscutter/command/commands/GiveCommand.java index f3f2adc17..2f020f7b3 100644 --- a/src/main/java/emu/grasscutter/command/commands/GiveCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/GiveCommand.java @@ -15,6 +15,8 @@ import java.util.List; import java.util.regex.Pattern; import java.util.regex.Matcher; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "give", usage = "give <itemId|itemName> [amount] [level]", description = "Gives an item to you or the specified player", aliases = { "g", "item", "giveitem"}, permission = "player.give") public final class GiveCommand implements CommandHandler { @@ -33,7 +35,7 @@ public final class GiveCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } int item; @@ -67,21 +69,21 @@ public final class GiveCommand implements CommandHandler { try { refinement = Integer.parseInt(args.get(3)); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_item_refinement); + CommandHandler.sendMessage(sender, translate("commands.generic.invalid.itemRefinement")); return; } // Fallthrough case 3: // <itemId|itemName> [amount] [level] try { lvl = Integer.parseInt(args.get(2)); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_item_level); + CommandHandler.sendMessage(sender, translate("commands.generic.invalid.itemLevel")); return; } // Fallthrough case 2: // <itemId|itemName> [amount] try { amount = Integer.parseInt(args.get(1)); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_amount); + CommandHandler.sendMessage(sender, translate("commands.generic.invalid.amount")); return; } // Fallthrough case 1: // <itemId|itemName> @@ -89,30 +91,28 @@ public final class GiveCommand implements CommandHandler { item = Integer.parseInt(args.get(0)); } catch (NumberFormatException ignored) { // TODO: Parse from item name using GM Handbook. - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_item_id); + CommandHandler.sendMessage(sender, translate("commands.generic.invalid.itemId")); return; } break; default: // *No args* - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Give_usage); + CommandHandler.sendMessage(sender, translate("commands.give.usage")); return; } - - ItemData itemData = GameData.getItemDataMap().get(item); if (itemData == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_item_id); + CommandHandler.sendMessage(sender, translate("commands.generic.invalid.itemId")); return; } if (refinement != 0) { if (itemData.getItemType() == ItemType.ITEM_WEAPON) { if (refinement < 1 || refinement > 5) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Give_refinement_must_between_1_and_5); + CommandHandler.sendMessage(sender, translate("commands.give.refinement_must_between_1_and_5")); return; } } else { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Give_refinement_only_applicable_weapons); + CommandHandler.sendMessage(sender, translate("commands.give.refinement_only_applicable_weapons")); return; } } @@ -120,11 +120,11 @@ public final class GiveCommand implements CommandHandler { this.item(targetPlayer, itemData, amount, lvl, refinement); if (!itemData.isEquip()) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Give_given.replace("{amount}", Integer.toString(amount)).replace("{item}", Integer.toString(item)).replace("{target}", Integer.toString(targetPlayer.getUid()))); + CommandHandler.sendMessage(sender, translate("commands.give.given", Integer.toString(amount), Integer.toString(item), Integer.toString(targetPlayer.getUid()))); } else if (itemData.getItemType() == ItemType.ITEM_WEAPON) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Give_given_with_level_and_refinement.replace("{item}", Integer.toString(item)).replace("{lvl}", Integer.toString(lvl)).replace("{refinement}", Integer.toString(refinement)).replace("{amount}", Integer.toString(amount)).replace("{target}", Integer.toString(targetPlayer.getUid()))); + CommandHandler.sendMessage(sender, translate("commands.give.given_with_level_and_refinement", Integer.toString(item), Integer.toString(lvl), Integer.toString(refinement), Integer.toString(amount), Integer.toString(targetPlayer.getUid()))); } else { - CommandHandler.sendMessage(sender,Grasscutter.getLanguage().Give_given_level.replace("{item}", Integer.toString(item)).replace("{lvl}", Integer.toString(lvl)).replace("{amount}", Integer.toString(amount))); + CommandHandler.sendMessage(sender, translate("commands.give.given_level", Integer.toString(item), Integer.toString(lvl), Integer.toString(amount))); } } diff --git a/src/main/java/emu/grasscutter/command/commands/GodModeCommand.java b/src/main/java/emu/grasscutter/command/commands/GodModeCommand.java index 73ec8b032..9abebb8db 100644 --- a/src/main/java/emu/grasscutter/command/commands/GodModeCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/GodModeCommand.java @@ -7,6 +7,8 @@ import emu.grasscutter.game.player.Player; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "godmode", usage = "godmode [on|off|toggle]", description = "Prevents you from taking damage. Defaults to toggle.", permission = "player.godmode") public final class GodModeCommand implements CommandHandler { @@ -14,7 +16,7 @@ public final class GodModeCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } @@ -30,11 +32,11 @@ public final class GodModeCommand implements CommandHandler { case "toggle": break; // Already toggled default: - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Godmode_status); + break; } } targetPlayer.setGodmode(enabled); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Godmode_status.replace("{status}", (enabled ? Grasscutter.getLanguage().Enabled : Grasscutter.getLanguage().Disabled)).replace("{name}", targetPlayer.getNickname())); + CommandHandler.sendMessage(sender, translate("commands.godmode.success", (enabled ? translate("commands.status.enabled") : translate("commands.status.disabled")), targetPlayer.getNickname())); } } diff --git a/src/main/java/emu/grasscutter/command/commands/HealCommand.java b/src/main/java/emu/grasscutter/command/commands/HealCommand.java index e61cfd98f..bb0b861b0 100644 --- a/src/main/java/emu/grasscutter/command/commands/HealCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/HealCommand.java @@ -1,6 +1,5 @@ package emu.grasscutter.command.commands; -import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; import emu.grasscutter.game.player.Player; @@ -10,13 +9,15 @@ import emu.grasscutter.server.packet.send.PacketAvatarLifeStateChangeNotify; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "heal", usage = "heal|h", aliases = {"h"}, description = "Heal all characters in your current team.", permission = "player.heal") public final class HealCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } @@ -31,6 +32,6 @@ public final class HealCommand implements CommandHandler { entity.getWorld().broadcastPacket(new PacketAvatarLifeStateChangeNotify(entity.getAvatar())); } }); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Heal_message); + CommandHandler.sendMessage(sender, translate("commands.heal.success")); } } diff --git a/src/main/java/emu/grasscutter/command/commands/HelpCommand.java b/src/main/java/emu/grasscutter/command/commands/HelpCommand.java index 8397eae3e..93ac831b3 100644 --- a/src/main/java/emu/grasscutter/command/commands/HelpCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/HelpCommand.java @@ -8,6 +8,8 @@ import emu.grasscutter.game.player.Player; import java.util.*; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "help", usage = "help [command]", description = "Sends the help message or shows information about a specified command") public final class HelpCommand implements CommandHandler { @@ -31,16 +33,16 @@ public final class HelpCommand implements CommandHandler { } else { String command = args.get(0); CommandHandler handler = CommandMap.getInstance().getHandler(command); - StringBuilder builder = new StringBuilder(player == null ? "\n" + Grasscutter.getLanguage().Help + " - " : Grasscutter.getLanguage().Help + " - ").append(command).append(": \n"); + StringBuilder builder = new StringBuilder(player == null ? "\n" + translate("commands.status.help") + " - " : translate("commands.status.help") + " - ").append(command).append(": \n"); if (handler == null) { - builder.append(Grasscutter.getLanguage().No_command_found); + builder.append(translate("commands.generic.command_exist_error")); } else { Command annotation = handler.getClass().getAnnotation(Command.class); builder.append(" ").append(annotation.description()).append("\n"); - builder.append(Grasscutter.getLanguage().Help_usage).append(annotation.usage()); + builder.append(translate("commands.help.usage")).append(annotation.usage()); if (annotation.aliases().length >= 1) { - builder.append("\n").append(Grasscutter.getLanguage().Help_aliases); + builder.append("\n").append(translate("commands.help.aliases")); for (String alias : annotation.aliases()) { builder.append(alias).append(" "); } @@ -56,13 +58,13 @@ public final class HelpCommand implements CommandHandler { void SendAllHelpMessage(Player player, List<Command> annotations) { if (player == null) { - StringBuilder builder = new StringBuilder("\n" + Grasscutter.getLanguage().Help_available_command + "\n"); + StringBuilder builder = new StringBuilder("\n" + translate("commands.help.available_commands") + "\n"); annotations.forEach(annotation -> { builder.append(annotation.label()).append("\n"); builder.append(" ").append(annotation.description()).append("\n"); - builder.append(Grasscutter.getLanguage().Help_usage).append(annotation.usage()); + builder.append(translate("commands.help.usage")).append(annotation.usage()); if (annotation.aliases().length >= 1) { - builder.append("\n").append(Grasscutter.getLanguage().Help_aliases); + builder.append("\n").append(translate("commands.help.aliases")); for (String alias : annotation.aliases()) { builder.append(alias).append(" "); } @@ -73,13 +75,13 @@ public final class HelpCommand implements CommandHandler { CommandHandler.sendMessage(null, builder.toString()); } else { - CommandHandler.sendMessage(player, Grasscutter.getLanguage().Help_available_command); + CommandHandler.sendMessage(player, translate("commands.help.available_commands")); annotations.forEach(annotation -> { StringBuilder builder = new StringBuilder(annotation.label()).append("\n"); builder.append(" ").append(annotation.description()).append("\n"); - builder.append(Grasscutter.getLanguage().Help_usage).append(annotation.usage()); + builder.append(translate("commands.help.usage")).append(annotation.usage()); if (annotation.aliases().length >= 1) { - builder.append("\n").append(Grasscutter.getLanguage().Help_aliases); + builder.append("\n").append(translate("commands.help.aliases")); for (String alias : annotation.aliases()) { builder.append(alias).append(" "); } diff --git a/src/main/java/emu/grasscutter/command/commands/KickCommand.java b/src/main/java/emu/grasscutter/command/commands/KickCommand.java index 0e3bb6c2b..270e28150 100644 --- a/src/main/java/emu/grasscutter/command/commands/KickCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/KickCommand.java @@ -1,12 +1,13 @@ package emu.grasscutter.command.commands; -import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; import emu.grasscutter.game.player.Player; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "kick", usage = "kick", description = "Kicks the specified player from the server (WIP)", permission = "server.kick") public final class KickCommand implements CommandHandler { @@ -14,14 +15,16 @@ public final class KickCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } if (sender != null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Kick_player_kick_player.replace("{sendUid}", Integer.toString(sender.getAccount().getPlayerUid())).replace("{sendName}", sender.getAccount().getUsername()).replace("kickUid", Integer.toString(targetPlayer.getUid())).replace("{kickName}", targetPlayer.getAccount().getUsername())); + CommandHandler.sendMessage(sender, translate("commands.kick.player_kick_player", + Integer.toString(sender.getAccount().getPlayerUid()), sender.getAccount().getUsername(), + Integer.toString(targetPlayer.getUid()), targetPlayer.getAccount().getUsername())); } else { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Kick_server_player.replace("{kickUid}", Integer.toString(targetPlayer.getUid())).replace("{kickName}", targetPlayer.getAccount().getUsername())); + CommandHandler.sendMessage(null, translate("commands.kick.server_kick_player", Integer.toString(targetPlayer.getUid()), targetPlayer.getAccount().getUsername())); } targetPlayer.getSession().close(); diff --git a/src/main/java/emu/grasscutter/command/commands/KillAllCommand.java b/src/main/java/emu/grasscutter/command/commands/KillAllCommand.java index 0e3660c1b..423c60bbd 100644 --- a/src/main/java/emu/grasscutter/command/commands/KillAllCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/KillAllCommand.java @@ -10,6 +10,8 @@ import emu.grasscutter.game.world.Scene; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "killall", usage = "killall [sceneId]", description = "Kill all entities", permission = "server.killall") public final class KillAllCommand implements CommandHandler { @@ -17,7 +19,7 @@ public final class KillAllCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } @@ -30,14 +32,14 @@ public final class KillAllCommand implements CommandHandler { scene = targetPlayer.getWorld().getSceneById(Integer.parseInt(args.get(0))); break; default: - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Kill_usage); + CommandHandler.sendMessage(sender, translate("commands.kill.usage")); return; } } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_arguments); + CommandHandler.sendMessage(sender, translate("commands.execution.argument_error")); } if (scene == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Kill_scene_not_found_in_player_world); + CommandHandler.sendMessage(sender, translate("commands.kill.scene_not_found_in_player_world")); return; } @@ -46,7 +48,7 @@ public final class KillAllCommand implements CommandHandler { List<GameEntity> toKill = sceneF.getEntities().values().stream() .filter(entity -> entity instanceof EntityMonster) .toList(); - toKill.stream().forEach(entity -> sceneF.killEntity(entity, 0)); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Kill_kill_monsters_in_scene.replace("{size}", Integer.toString(toKill.size())).replace("{id}", Integer.toString(scene.getId()))); + toKill.forEach(entity -> sceneF.killEntity(entity, 0)); + CommandHandler.sendMessage(sender, translate("commands.kill.kill_monsters_in_scene", Integer.toString(toKill.size()), Integer.toString(scene.getId()))); } } diff --git a/src/main/java/emu/grasscutter/command/commands/KillCharacterCommand.java b/src/main/java/emu/grasscutter/command/commands/KillCharacterCommand.java index 7dc01363d..82a18f72d 100644 --- a/src/main/java/emu/grasscutter/command/commands/KillCharacterCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/KillCharacterCommand.java @@ -19,7 +19,7 @@ public final class KillCharacterCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } diff --git a/src/main/java/emu/grasscutter/command/commands/PermissionCommand.java b/src/main/java/emu/grasscutter/command/commands/PermissionCommand.java index 6e041f338..aa99939f6 100644 --- a/src/main/java/emu/grasscutter/command/commands/PermissionCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/PermissionCommand.java @@ -8,6 +8,8 @@ import emu.grasscutter.game.player.Player; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "permission", usage = "permission <add|remove> <permission>", description = "Grants or removes a permission for a user", permission = "*") public final class PermissionCommand implements CommandHandler { @@ -15,7 +17,7 @@ public final class PermissionCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } diff --git a/src/main/java/emu/grasscutter/command/commands/PositionCommand.java b/src/main/java/emu/grasscutter/command/commands/PositionCommand.java index 0e015d178..7f6548c5b 100644 --- a/src/main/java/emu/grasscutter/command/commands/PositionCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/PositionCommand.java @@ -1,6 +1,5 @@ package emu.grasscutter.command.commands; -import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; import emu.grasscutter.game.player.Player; @@ -8,6 +7,8 @@ import emu.grasscutter.utils.Position; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "position", usage = "position", aliases = {"pos"}, description = "Get coordinates.") public final class PositionCommand implements CommandHandler { @@ -15,11 +16,13 @@ public final class PositionCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } Position pos = targetPlayer.getPos(); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Position_message.replace("{x}", Float.toString(pos.getX())).replace("{y}", Float.toString(pos.getY())).replace("{z}", Float.toString(pos.getZ())).replace("{id}", Integer.toString(targetPlayer.getSceneId()))); + CommandHandler.sendMessage(sender, translate("commands.position.success", + Float.toString(pos.getX()), Float.toString(pos.getY()), Float.toString(pos.getZ()), + Integer.toString(targetPlayer.getSceneId()))); } } diff --git a/src/main/java/emu/grasscutter/command/commands/ReloadCommand.java b/src/main/java/emu/grasscutter/command/commands/ReloadCommand.java index 0e45c4efc..6c85d2024 100644 --- a/src/main/java/emu/grasscutter/command/commands/ReloadCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/ReloadCommand.java @@ -7,19 +7,23 @@ import emu.grasscutter.game.player.Player; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "reload", usage = "reload", description = "Reload server config", permission = "server.reload") public final class ReloadCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Reload_reload_start); + CommandHandler.sendMessage(sender, translate("commands.reload.reload_start")); + Grasscutter.loadConfig(); Grasscutter.loadLanguage(); Grasscutter.getGameServer().getGachaManager().load(); Grasscutter.getGameServer().getDropManager().load(); Grasscutter.getGameServer().getShopManager().load(); Grasscutter.getDispatchServer().loadQueries(); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Reload_reload_done); + + CommandHandler.sendMessage(sender, translate("commands.reload.reload_done")); } } diff --git a/src/main/java/emu/grasscutter/command/commands/ResetConstCommand.java b/src/main/java/emu/grasscutter/command/commands/ResetConstCommand.java index 52ed0a55e..706fb95e0 100644 --- a/src/main/java/emu/grasscutter/command/commands/ResetConstCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/ResetConstCommand.java @@ -1,6 +1,5 @@ package emu.grasscutter.command.commands; -import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; import emu.grasscutter.game.avatar.Avatar; @@ -9,6 +8,8 @@ import emu.grasscutter.game.player.Player; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "resetconst", usage = "resetconst [all]", description = "Resets the constellation level on your current active character, will need to relog after using the command to see any changes.", aliases = {"resetconstellation"}, permission = "player.resetconstellation") @@ -17,13 +18,13 @@ public final class ResetConstCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } if (args.size() > 0 && args.get(0).equalsIgnoreCase("all")) { targetPlayer.getAvatars().forEach(this::resetConstellation); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().ResetConst_reset_all); + CommandHandler.sendMessage(sender, translate("commands.resetConst.reset_all")); } else { EntityAvatar entity = targetPlayer.getTeamManager().getCurrentAvatarEntity(); if (entity == null) { @@ -33,7 +34,7 @@ public final class ResetConstCommand implements CommandHandler { Avatar avatar = entity.getAvatar(); this.resetConstellation(avatar); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().ResetConst_reset_all_done.replace("{name}", avatar.getAvatarData().getName())); + CommandHandler.sendMessage(sender, translate("commands.resetConst.success", avatar.getAvatarData().getName())); } } diff --git a/src/main/java/emu/grasscutter/command/commands/ResetShopLimitCommand.java b/src/main/java/emu/grasscutter/command/commands/ResetShopLimitCommand.java index f2cbf3476..59d8b32e8 100644 --- a/src/main/java/emu/grasscutter/command/commands/ResetShopLimitCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/ResetShopLimitCommand.java @@ -13,7 +13,7 @@ public final class ResetShopLimitCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } diff --git a/src/main/java/emu/grasscutter/command/commands/SendMailCommand.java b/src/main/java/emu/grasscutter/command/commands/SendMailCommand.java index da0414f79..838bea567 100644 --- a/src/main/java/emu/grasscutter/command/commands/SendMailCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SendMailCommand.java @@ -10,6 +10,9 @@ import emu.grasscutter.game.player.Player; import java.util.HashMap; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + +@SuppressWarnings("ConstantConditions") @Command(label = "sendmail", usage = "sendmail <userId|all|help> [templateId]", description = "Sends mail to the specified user. The usage of this command changes based on it's composition state.", permission = "server.sendmail") public final class SendMailCommand implements CommandHandler { @@ -45,16 +48,16 @@ public final class SendMailCommand implements CommandHandler { if (DatabaseHelper.getPlayerById(Integer.parseInt(args.get(0))) != null) { mailBuilder = new MailBuilder(Integer.parseInt(args.get(0)), new Mail()); } else { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SendMail_user_not_exist.replace("{id}", args.get(0))); + CommandHandler.sendMessage(sender, translate("commands.sendMail.user_not_exist", args.get(0))); return; } } } mailBeingConstructed.put(senderId, mailBuilder); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SendMail_start_composition); + CommandHandler.sendMessage(sender, translate("commands.sendMail.start_composition")); } - case 2 -> CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SendMail_templates); - default -> CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SendMail_invalid_arguments); + case 2 -> CommandHandler.sendMessage(sender, translate("commands.sendMail.templates")); + default -> CommandHandler.sendMessage(sender, translate("commands.sendMail.invalid_arguments")); } } else { MailBuilder mailBuilder = mailBeingConstructed.get(senderId); @@ -63,28 +66,28 @@ public final class SendMailCommand implements CommandHandler { switch (args.get(0).toLowerCase()) { case "stop" -> { mailBeingConstructed.remove(senderId); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SendMail_send_cancel); + CommandHandler.sendMessage(sender, translate("commands.sendMail.sendCancel")); return; } case "finish" -> { if (mailBuilder.constructionStage == 3) { if (!mailBuilder.sendToAll) { Grasscutter.getGameServer().getPlayerByUid(mailBuilder.recipient, true).sendMail(mailBuilder.mail); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SendMail_send_done.replace("{name}", Integer.toString(mailBuilder.recipient))); + CommandHandler.sendMessage(sender, translate("commands.sendMail.send_done", Integer.toString(mailBuilder.recipient))); } else { for (Player player : DatabaseHelper.getAllPlayers()) { Grasscutter.getGameServer().getPlayerByUid(player.getUid(), true).sendMail(mailBuilder.mail); } - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SendMail_send_all_done); + CommandHandler.sendMessage(sender, translate("commands.sendMail.send_all_done")); } mailBeingConstructed.remove(senderId); } else { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SendMail_not_composition_end.replace("{args}", getConstructionArgs(mailBuilder.constructionStage))); + CommandHandler.sendMessage(sender, translate("commands.sendMail.not_composition_end", getConstructionArgs(mailBuilder.constructionStage))); } return; } case "help" -> { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SendMail_please_use.replace("{args}", getConstructionArgs(mailBuilder.constructionStage))); + CommandHandler.sendMessage(sender, translate("commands.sendMail.please_use", getConstructionArgs(mailBuilder.constructionStage))); return; } default -> { @@ -92,19 +95,19 @@ public final class SendMailCommand implements CommandHandler { case 0 -> { String title = String.join(" ", args.subList(0, args.size())); mailBuilder.mail.mailContent.title = title; - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SendMail_set_title.replace("{title}", title)); + CommandHandler.sendMessage(sender, translate("commands.sendMail.set_title", title)); mailBuilder.constructionStage++; } case 1 -> { String contents = String.join(" ", args.subList(0, args.size())); mailBuilder.mail.mailContent.content = contents; - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SendMail_set_contents.replace("{contents}", contents)); + CommandHandler.sendMessage(sender, translate("commands.sendMail.set_contents", contents)); mailBuilder.constructionStage++; } case 2 -> { String msgSender = String.join(" ", args.subList(0, args.size())); mailBuilder.mail.mailContent.sender = msgSender; - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SendMail_set_message_sender.replace("{send}", msgSender)); + CommandHandler.sendMessage(sender, translate("commands.sendMail.set_message_sender", msgSender)); mailBuilder.constructionStage++; } case 3 -> { @@ -117,21 +120,21 @@ public final class SendMailCommand implements CommandHandler { try { refinement = Integer.parseInt(args.get(3)); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_item_refinement); + CommandHandler.sendMessage(sender, translate("commands.generic.invalid.itemRefinement")); return; } // Fallthrough case 3: // <itemId|itemName> [amount] [level] try { lvl = Integer.parseInt(args.get(2)); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_item_level); + CommandHandler.sendMessage(sender, translate("commands.generic.invalid.itemLevel")); return; } // Fallthrough case 2: // <itemId|itemName> [amount] try { amount = Integer.parseInt(args.get(1)); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_amount); + CommandHandler.sendMessage(sender, translate("commands.generic.invalid.amount")); return; } // Fallthrough case 1: // <itemId|itemName> @@ -139,46 +142,34 @@ public final class SendMailCommand implements CommandHandler { item = Integer.parseInt(args.get(0)); } catch (NumberFormatException ignored) { // TODO: Parse from item name using GM Handbook. - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_item_id); + CommandHandler.sendMessage(sender, translate("commands.generic.invalid.itemId")); return; } break; default: // *No args* - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Give_usage); + CommandHandler.sendMessage(sender, translate("commands.give.usage")); return; } mailBuilder.mail.itemList.add(new Mail.MailItem(item, amount, lvl)); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SendMail_send.replace("{amount}", Integer.toString(amount)).replace("{item}", Integer.toString(item)).replace("{lvl}", Integer.toString(lvl))); + CommandHandler.sendMessage(sender, translate("commands.sendMail.send", Integer.toString(amount), Integer.toString(item), Integer.toString(lvl))); } } } } } else { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SendMail_invalid_arguments_please_use.replace("{args}", getConstructionArgs(mailBuilder.constructionStage))); + CommandHandler.sendMessage(sender, translate("commands.sendMail.invalid_arguments_please_use", getConstructionArgs(mailBuilder.constructionStage))); } } } private String getConstructionArgs(int stage) { - switch (stage) { - case 0 -> { - return Grasscutter.getLanguage().SendMail_title; - } - case 1 -> { - return Grasscutter.getLanguage().SendMail_message; - } - case 2 -> { - return Grasscutter.getLanguage().SendMail_sender; - - } - case 3 -> { - return Grasscutter.getLanguage().SendMail_arguments; - } - default -> { - Thread.dumpStack(); - return Grasscutter.getLanguage().SendMail_error.replace("{stage}", Integer.toString(stage)); - } - } + return switch(stage) { + case 0 -> translate("commands.sendMail.title"); + case 1 -> translate("commands.sendMail.message"); + case 2 -> translate("commands.sendMail.sender"); + case 3 -> translate("commands.sendMail.arguments"); + default -> translate("commands.sendMail.error", Integer.toString(stage)); + }; } public static class MailBuilder { diff --git a/src/main/java/emu/grasscutter/command/commands/SendMessageCommand.java b/src/main/java/emu/grasscutter/command/commands/SendMessageCommand.java index e04d3817e..41f76ba80 100644 --- a/src/main/java/emu/grasscutter/command/commands/SendMessageCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SendMessageCommand.java @@ -7,6 +7,8 @@ import emu.grasscutter.game.player.Player; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "say", usage = "say <message>", description = "Sends a message to a player as the server", aliases = {"sendservmsg", "sendservermessage", "sendmessage"}, permission = "server.sendmessage") public final class SendMessageCommand implements CommandHandler { @@ -14,7 +16,7 @@ public final class SendMessageCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } if (args.size() == 0) { diff --git a/src/main/java/emu/grasscutter/command/commands/SetFetterLevelCommand.java b/src/main/java/emu/grasscutter/command/commands/SetFetterLevelCommand.java index f1768c72d..21507b998 100644 --- a/src/main/java/emu/grasscutter/command/commands/SetFetterLevelCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SetFetterLevelCommand.java @@ -18,7 +18,7 @@ public final class SetFetterLevelCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } diff --git a/src/main/java/emu/grasscutter/command/commands/SetStatsCommand.java b/src/main/java/emu/grasscutter/command/commands/SetStatsCommand.java index 48dbe141f..3498e267b 100644 --- a/src/main/java/emu/grasscutter/command/commands/SetStatsCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SetStatsCommand.java @@ -10,13 +10,15 @@ import emu.grasscutter.command.CommandHandler; import emu.grasscutter.game.entity.EntityAvatar; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.FightProperty; -import emu.grasscutter.languages.Language; import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify; +import emu.grasscutter.utils.Language; + +import static emu.grasscutter.utils.Language.translate; @Command(label = "setstats", usage = "setstats|stats <stat> <value>", description = "Set fight property for your current active character", aliases = {"stats"}, permission = "player.setstats") public final class SetStatsCommand implements CommandHandler { - class Stat { + static class Stat { String name; FightProperty prop; boolean percent; @@ -27,44 +29,44 @@ public final class SetStatsCommand implements CommandHandler { this.percent = percent; } } - Map<String, Stat> stats; + + Map<String, Stat> stats = new HashMap<>(); public SetStatsCommand() { Language lang = Grasscutter.getLanguage(); - stats = new HashMap<String, Stat>(); // Default stats - stats.put("maxhp", new Stat(lang.Stats_FIGHT_PROP_MAX_HP, FightProperty.FIGHT_PROP_MAX_HP, false)); - stats.put("hp", new Stat(lang.Stats_FIGHT_PROP_CUR_HP, FightProperty.FIGHT_PROP_CUR_HP, false)); - stats.put("atk", new Stat(lang.Stats_FIGHT_PROP_CUR_ATTACK, FightProperty.FIGHT_PROP_CUR_ATTACK, false)); - stats.put("atkb", new Stat(lang.Stats_FIGHT_PROP_BASE_ATTACK, FightProperty.FIGHT_PROP_BASE_ATTACK, false)); // This doesn't seem to get used to recalculate ATK, so it's only useful for stuff like Bennett's buff. - stats.put("def", new Stat(lang.Stats_FIGHT_PROP_DEFENSE, FightProperty.FIGHT_PROP_DEFENSE, false)); - stats.put("em", new Stat(lang.Stats_FIGHT_PROP_ELEMENT_MASTERY, FightProperty.FIGHT_PROP_ELEMENT_MASTERY, false)); - stats.put("er", new Stat(lang.Stats_FIGHT_PROP_CHARGE_EFFICIENCY, FightProperty.FIGHT_PROP_CHARGE_EFFICIENCY, true)); - stats.put("crate", new Stat(lang.Stats_FIGHT_PROP_CRITICAL, FightProperty.FIGHT_PROP_CRITICAL, true)); - stats.put("cdmg", new Stat(lang.Stats_FIGHT_PROP_CRITICAL_HURT, FightProperty.FIGHT_PROP_CRITICAL_HURT, true)); - stats.put("dmg", new Stat(lang.Stats_FIGHT_PROP_ADD_HURT, FightProperty.FIGHT_PROP_ADD_HURT, true)); // This seems to get reset after attacks - stats.put("eanemo", new Stat(lang.Stats_FIGHT_PROP_WIND_ADD_HURT, FightProperty.FIGHT_PROP_WIND_ADD_HURT, true)); - stats.put("ecryo", new Stat(lang.Stats_FIGHT_PROP_ICE_ADD_HURT, FightProperty.FIGHT_PROP_ICE_ADD_HURT, true)); - stats.put("edendro", new Stat(lang.Stats_FIGHT_PROP_GRASS_ADD_HURT, FightProperty.FIGHT_PROP_GRASS_ADD_HURT, true)); - stats.put("eelectro", new Stat(lang.Stats_FIGHT_PROP_ELEC_ADD_HURT, FightProperty.FIGHT_PROP_ELEC_ADD_HURT, true)); - stats.put("egeo", new Stat(lang.Stats_FIGHT_PROP_ROCK_ADD_HURT, FightProperty.FIGHT_PROP_ROCK_ADD_HURT, true)); - stats.put("ehydro", new Stat(lang.Stats_FIGHT_PROP_WATER_ADD_HURT, FightProperty.FIGHT_PROP_WATER_ADD_HURT, true)); - stats.put("epyro", new Stat(lang.Stats_FIGHT_PROP_FIRE_ADD_HURT, FightProperty.FIGHT_PROP_FIRE_ADD_HURT, true)); - stats.put("ephys", new Stat(lang.Stats_FIGHT_PROP_PHYSICAL_ADD_HURT, FightProperty.FIGHT_PROP_PHYSICAL_ADD_HURT, true)); - stats.put("resall", new Stat(lang.Stats_FIGHT_PROP_SUB_HURT, FightProperty.FIGHT_PROP_SUB_HURT, true)); // This seems to get reset after attacks - stats.put("resanemo", new Stat(lang.Stats_FIGHT_PROP_WIND_SUB_HURT, FightProperty.FIGHT_PROP_WIND_SUB_HURT, true)); - stats.put("rescryo", new Stat(lang.Stats_FIGHT_PROP_ICE_SUB_HURT, FightProperty.FIGHT_PROP_ICE_SUB_HURT, true)); - stats.put("resdendro", new Stat(lang.Stats_FIGHT_PROP_GRASS_SUB_HURT, FightProperty.FIGHT_PROP_GRASS_SUB_HURT, true)); - stats.put("reselectro", new Stat(lang.Stats_FIGHT_PROP_ELEC_SUB_HURT, FightProperty.FIGHT_PROP_ELEC_SUB_HURT, true)); - stats.put("resgeo", new Stat(lang.Stats_FIGHT_PROP_ROCK_SUB_HURT, FightProperty.FIGHT_PROP_ROCK_SUB_HURT, true)); - stats.put("reshydro", new Stat(lang.Stats_FIGHT_PROP_WATER_SUB_HURT, FightProperty.FIGHT_PROP_WATER_SUB_HURT, true)); - stats.put("respyro", new Stat(lang.Stats_FIGHT_PROP_FIRE_SUB_HURT, FightProperty.FIGHT_PROP_FIRE_SUB_HURT, true)); - stats.put("resphys", new Stat(lang.Stats_FIGHT_PROP_PHYSICAL_SUB_HURT, FightProperty.FIGHT_PROP_PHYSICAL_SUB_HURT, true)); - stats.put("cdr", new Stat(lang.Stats_FIGHT_PROP_SKILL_CD_MINUS_RATIO, FightProperty.FIGHT_PROP_SKILL_CD_MINUS_RATIO, true)); - stats.put("heal", new Stat(lang.Stats_FIGHT_PROP_HEAL_ADD, FightProperty.FIGHT_PROP_HEAL_ADD, true)); - stats.put("heali", new Stat(lang.Stats_FIGHT_PROP_HEALED_ADD, FightProperty.FIGHT_PROP_HEALED_ADD, true)); - stats.put("shield", new Stat(lang.Stats_FIGHT_PROP_SHIELD_COST_MINUS_RATIO, FightProperty.FIGHT_PROP_SHIELD_COST_MINUS_RATIO, true)); - stats.put("defi", new Stat(lang.Stats_FIGHT_PROP_DEFENCE_IGNORE_RATIO, FightProperty.FIGHT_PROP_DEFENCE_IGNORE_RATIO, true)); + stats.put("maxhp", new Stat(FightProperty.FIGHT_PROP_MAX_HP.toString(), FightProperty.FIGHT_PROP_MAX_HP, false)); + stats.put("hp", new Stat(FightProperty.FIGHT_PROP_CUR_HP.toString(), FightProperty.FIGHT_PROP_CUR_HP, false)); + stats.put("atk", new Stat(FightProperty.FIGHT_PROP_CUR_ATTACK.toString(), FightProperty.FIGHT_PROP_CUR_ATTACK, false)); + stats.put("atkb", new Stat(FightProperty.FIGHT_PROP_BASE_ATTACK.toString(), FightProperty.FIGHT_PROP_BASE_ATTACK, false)); // This doesn't seem to get used to recalculate ATK, so it's only useful for stuff like Bennett's buff. + stats.put("def", new Stat(FightProperty.FIGHT_PROP_DEFENSE.toString(), FightProperty.FIGHT_PROP_DEFENSE, false)); + stats.put("em", new Stat(FightProperty.FIGHT_PROP_ELEMENT_MASTERY.toString(), FightProperty.FIGHT_PROP_ELEMENT_MASTERY, false)); + stats.put("er", new Stat(FightProperty.FIGHT_PROP_CHARGE_EFFICIENCY.toString(), FightProperty.FIGHT_PROP_CHARGE_EFFICIENCY, true)); + stats.put("crate", new Stat(FightProperty.FIGHT_PROP_CRITICAL.toString(), FightProperty.FIGHT_PROP_CRITICAL, true)); + stats.put("cdmg", new Stat(FightProperty.FIGHT_PROP_CRITICAL_HURT.toString(), FightProperty.FIGHT_PROP_CRITICAL_HURT, true)); + stats.put("dmg", new Stat(FightProperty.FIGHT_PROP_ADD_HURT.toString(), FightProperty.FIGHT_PROP_ADD_HURT, true)); // This seems to get reset after attacks + stats.put("eanemo", new Stat(FightProperty.FIGHT_PROP_WIND_ADD_HURT.toString(), FightProperty.FIGHT_PROP_WIND_ADD_HURT, true)); + stats.put("ecryo", new Stat(FightProperty.FIGHT_PROP_ICE_ADD_HURT.toString(), FightProperty.FIGHT_PROP_ICE_ADD_HURT, true)); + stats.put("edendro", new Stat(FightProperty.FIGHT_PROP_GRASS_ADD_HURT.toString(), FightProperty.FIGHT_PROP_GRASS_ADD_HURT, true)); + stats.put("eelectro", new Stat(FightProperty.FIGHT_PROP_ELEC_ADD_HURT.toString(), FightProperty.FIGHT_PROP_ELEC_ADD_HURT, true)); + stats.put("egeo", new Stat(FightProperty.FIGHT_PROP_ROCK_ADD_HURT.toString(), FightProperty.FIGHT_PROP_ROCK_ADD_HURT, true)); + stats.put("ehydro", new Stat(FightProperty.FIGHT_PROP_WATER_ADD_HURT.toString(), FightProperty.FIGHT_PROP_WATER_ADD_HURT, true)); + stats.put("epyro", new Stat(FightProperty.FIGHT_PROP_FIRE_ADD_HURT.toString(), FightProperty.FIGHT_PROP_FIRE_ADD_HURT, true)); + stats.put("ephys", new Stat(FightProperty.FIGHT_PROP_PHYSICAL_ADD_HURT.toString(), FightProperty.FIGHT_PROP_PHYSICAL_ADD_HURT, true)); + stats.put("resall", new Stat(FightProperty.FIGHT_PROP_SUB_HURT.toString(), FightProperty.FIGHT_PROP_SUB_HURT, true)); // This seems to get reset after attacks + stats.put("resanemo", new Stat(FightProperty.FIGHT_PROP_WIND_SUB_HURT.toString(), FightProperty.FIGHT_PROP_WIND_SUB_HURT, true)); + stats.put("rescryo", new Stat(FightProperty.FIGHT_PROP_ICE_SUB_HURT.toString(), FightProperty.FIGHT_PROP_ICE_SUB_HURT, true)); + stats.put("resdendro", new Stat(FightProperty.FIGHT_PROP_GRASS_SUB_HURT.toString(), FightProperty.FIGHT_PROP_GRASS_SUB_HURT, true)); + stats.put("reselectro", new Stat(FightProperty.FIGHT_PROP_ELEC_SUB_HURT.toString(), FightProperty.FIGHT_PROP_ELEC_SUB_HURT, true)); + stats.put("resgeo", new Stat(FightProperty.FIGHT_PROP_ROCK_SUB_HURT.toString(), FightProperty.FIGHT_PROP_ROCK_SUB_HURT, true)); + stats.put("reshydro", new Stat(FightProperty.FIGHT_PROP_WATER_SUB_HURT.toString(), FightProperty.FIGHT_PROP_WATER_SUB_HURT, true)); + stats.put("respyro", new Stat(FightProperty.FIGHT_PROP_FIRE_SUB_HURT.toString(), FightProperty.FIGHT_PROP_FIRE_SUB_HURT, true)); + stats.put("resphys", new Stat(FightProperty.FIGHT_PROP_PHYSICAL_SUB_HURT.toString(), FightProperty.FIGHT_PROP_PHYSICAL_SUB_HURT, true)); + stats.put("cdr", new Stat(FightProperty.FIGHT_PROP_SKILL_CD_MINUS_RATIO.toString(), FightProperty.FIGHT_PROP_SKILL_CD_MINUS_RATIO, true)); + stats.put("heal", new Stat(FightProperty.FIGHT_PROP_HEAL_ADD.toString(), FightProperty.FIGHT_PROP_HEAL_ADD, true)); + stats.put("heali", new Stat(FightProperty.FIGHT_PROP_HEALED_ADD.toString(), FightProperty.FIGHT_PROP_HEALED_ADD, true)); + stats.put("shield", new Stat(FightProperty.FIGHT_PROP_SHIELD_COST_MINUS_RATIO.toString(), FightProperty.FIGHT_PROP_SHIELD_COST_MINUS_RATIO, true)); + stats.put("defi", new Stat(FightProperty.FIGHT_PROP_DEFENCE_IGNORE_RATIO.toString(), FightProperty.FIGHT_PROP_DEFENCE_IGNORE_RATIO, true)); // Compatibility aliases stats.put("mhp", stats.get("maxhp")); stats.put("cr", stats.get("crate")); @@ -175,26 +177,23 @@ public final class SetStatsCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { - Language lang = Grasscutter.getLanguage(); - String syntax = sender == null ? lang.SetStats_usage_console : lang.SetStats_usage_console; - String usage = syntax + lang.SetStats_help_message; + String syntax = sender == null ? translate("commands.setStats.usage_console") : translate("commands.setStats.ingame"); + String usage = syntax + translate("commands.setStats.help_message"); String statStr; String valueStr; if (targetPlayer == null) { - CommandHandler.sendMessage(sender, lang.Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } - switch (args.size()) { - default: - CommandHandler.sendMessage(sender, usage); - return; - case 2: - statStr = args.get(0).toLowerCase(); - valueStr = args.get(1); - break; - }; + if (args.size() == 2) { + statStr = args.get(0).toLowerCase(); + valueStr = args.get(1); + } else { + CommandHandler.sendMessage(sender, usage); + return; + } EntityAvatar entity = targetPlayer.getTeamManager().getCurrentAvatarEntity(); @@ -206,7 +205,7 @@ public final class SetStatsCommand implements CommandHandler { value = Float.parseFloat(valueStr); } } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, lang.SetStats_value_error); + CommandHandler.sendMessage(sender, translate("commands.setStats.value_error")); return; } @@ -220,15 +219,14 @@ public final class SetStatsCommand implements CommandHandler { valueStr = String.format("%.0f", value); } if (targetPlayer == sender) { - CommandHandler.sendMessage(sender, lang.SetStats_set_self.replace("{name}", stat.name).replace("{value}", valueStr)); + CommandHandler.sendMessage(sender, translate("commands.setStats.set_self", stat.name, valueStr)); } else { String uidStr = targetPlayer.getAccount().getId(); - CommandHandler.sendMessage(sender, lang.SetStats_set_for_uid.replace("{name}", stat.name).replace("{uid}", uidStr).replace("{value}", valueStr)); + CommandHandler.sendMessage(sender, translate("commands.setStats.set_self", stat.name, uidStr, valueStr)); } - return; } else { CommandHandler.sendMessage(sender, usage); - return; } + return; } } diff --git a/src/main/java/emu/grasscutter/command/commands/SetWorldLevelCommand.java b/src/main/java/emu/grasscutter/command/commands/SetWorldLevelCommand.java index cd53237ca..39f4753a7 100644 --- a/src/main/java/emu/grasscutter/command/commands/SetWorldLevelCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SetWorldLevelCommand.java @@ -15,7 +15,7 @@ public final class SetWorldLevelCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } diff --git a/src/main/java/emu/grasscutter/command/commands/SpawnCommand.java b/src/main/java/emu/grasscutter/command/commands/SpawnCommand.java index 48d6235cb..c50eb972d 100644 --- a/src/main/java/emu/grasscutter/command/commands/SpawnCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SpawnCommand.java @@ -27,7 +27,7 @@ public final class SpawnCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } diff --git a/src/main/java/emu/grasscutter/command/commands/TalentCommand.java b/src/main/java/emu/grasscutter/command/commands/TalentCommand.java index 559006473..c9b2e8931 100644 --- a/src/main/java/emu/grasscutter/command/commands/TalentCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/TalentCommand.java @@ -12,13 +12,15 @@ import emu.grasscutter.server.packet.send.PacketAvatarSkillUpgradeRsp; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "talent", usage = "talent <talentID> <value>", description = "Set talent level for your current active character", permission = "player.settalent") public final class TalentCommand implements CommandHandler { private void setTalentLevel(Player sender, Player player, Avatar avatar, int talentId, int talentLevel) { int oldLevel = avatar.getSkillLevelMap().get(talentId); if (talentLevel < 0 || talentLevel > 15) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Talent_lower_16); + CommandHandler.sendMessage(sender, translate("commands.talent.lower_16")); return; } @@ -30,29 +32,29 @@ public final class TalentCommand implements CommandHandler { player.sendPacket(new PacketAvatarSkillChangeNotify(avatar, talentId, oldLevel, talentLevel)); player.sendPacket(new PacketAvatarSkillUpgradeRsp(avatar, talentId, oldLevel, talentLevel)); - String successMessage = Grasscutter.getLanguage().Talent_set_id.replace("{id}", Integer.toString(talentId)); + String successMessage = "commands.talent.set_id"; AvatarSkillDepotData depot = avatar.getData().getSkillDepot(); if (talentId == depot.getSkills().get(0)) { - successMessage = Grasscutter.getLanguage().Talent_set_atk; + successMessage = "commands.talent.set_atk"; } else if (talentId == depot.getSkills().get(1)) { - successMessage = Grasscutter.getLanguage().Talent_set_e; + successMessage = "commands.talent.set_e"; } else if (talentId == depot.getEnergySkill()) { - successMessage = Grasscutter.getLanguage().Talent_set_q; + successMessage = "commands.talent.set_q"; } - CommandHandler.sendMessage(sender, successMessage.replace("{level}", Integer.toString(talentLevel))); + CommandHandler.sendMessage(sender, translate(successMessage, talentLevel)); } @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } if (args.size() < 1){ - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Talent_usage_1); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Talent_usage_2); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Talent_usage_3); + CommandHandler.sendMessage(sender, translate("commands.talent.usage_1")); + CommandHandler.sendMessage(sender, translate("commands.talent.usage_2")); + CommandHandler.sendMessage(sender, translate("commands.talent.usage_3")); return; } @@ -60,66 +62,54 @@ public final class TalentCommand implements CommandHandler { Avatar avatar = entity.getAvatar(); String cmdSwitch = args.get(0); switch (cmdSwitch) { - default: - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Talent_usage_1); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Talent_usage_2); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Talent_usage_3); - return; - case "set": - if (args.size() < 3){ - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Talent_usage_1); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Talent_usage_3); + default -> { + CommandHandler.sendMessage(sender, translate("commands.talent.usage_1")); + CommandHandler.sendMessage(sender, translate("commands.talent.usage_2")); + CommandHandler.sendMessage(sender, translate("commands.talent.usage_3")); + return; + } + case "set" -> { + if (args.size() < 3) { + CommandHandler.sendMessage(sender, translate("commands.talent.usage_1")); + CommandHandler.sendMessage(sender, translate("commands.talent.usage_3")); return; } - try { int skillId = Integer.parseInt(args.get(1)); int newLevel = Integer.parseInt(args.get(2)); setTalentLevel(sender, targetPlayer, avatar, skillId, newLevel); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Talent_invalid_skill_id); + CommandHandler.sendMessage(sender, translate("commands.talent.invalid_skill_id")); return; } - break; - case "n": - case "e": - case "q": - if (args.size() < 2){ - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Talent_usage_2); + } + case "n", "e", "q" -> { + if (args.size() < 2) { + CommandHandler.sendMessage(sender, translate("commands.talent.usage_2")); return; } - AvatarSkillDepotData SkillDepot = avatar.getData().getSkillDepot(); - int skillId; - switch (cmdSwitch) { - default: - skillId = SkillDepot.getSkills().get(0); - break; - case "e": - skillId = SkillDepot.getSkills().get(1); - break; - case "q": - skillId = SkillDepot.getEnergySkill(); - break; - } - + int skillId = switch (cmdSwitch) { + default -> SkillDepot.getSkills().get(0); + case "e" -> SkillDepot.getSkills().get(1); + case "q" -> SkillDepot.getEnergySkill(); + }; try { int newLevel = Integer.parseInt(args.get(1)); setTalentLevel(sender, targetPlayer, avatar, skillId, newLevel); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Talent_invalid_talent_level); + CommandHandler.sendMessage(sender, translate("commands.talent.invalid_level")); return; } - break; - case "getid": + } + case "getid" -> { int skillIdNorAtk = avatar.getData().getSkillDepot().getSkills().get(0); int skillIdE = avatar.getData().getSkillDepot().getSkills().get(1); int skillIdQ = avatar.getData().getSkillDepot().getEnergySkill(); - - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Talent_normal_attack_id.replace("{id}", Integer.toString(skillIdNorAtk))); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Talent_e_skill_id.replace("{id}", Integer.toString(skillIdE))); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Talent_q_skill_id.replace("{id}", Integer.toString(skillIdQ))); - break; + CommandHandler.sendMessage(sender, translate("commands.talent.normal_attack_id", Integer.toString(skillIdNorAtk))); + CommandHandler.sendMessage(sender, translate("commands.talent.e_skill_id", Integer.toString(skillIdE))); + CommandHandler.sendMessage(sender, translate("commands.talent.q_skill_id", Integer.toString(skillIdQ))); + } } } } diff --git a/src/main/java/emu/grasscutter/command/commands/TeleportAllCommand.java b/src/main/java/emu/grasscutter/command/commands/TeleportAllCommand.java index 4c9f2a9cd..fe9b5dc49 100644 --- a/src/main/java/emu/grasscutter/command/commands/TeleportAllCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/TeleportAllCommand.java @@ -14,7 +14,7 @@ public final class TeleportAllCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } diff --git a/src/main/java/emu/grasscutter/command/commands/TeleportCommand.java b/src/main/java/emu/grasscutter/command/commands/TeleportCommand.java index f5a533bef..ef7e68ae9 100644 --- a/src/main/java/emu/grasscutter/command/commands/TeleportCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/TeleportCommand.java @@ -26,7 +26,7 @@ public final class TeleportCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } diff --git a/src/main/java/emu/grasscutter/command/commands/WeatherCommand.java b/src/main/java/emu/grasscutter/command/commands/WeatherCommand.java index eaf73e53a..431e53853 100644 --- a/src/main/java/emu/grasscutter/command/commands/WeatherCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/WeatherCommand.java @@ -16,7 +16,7 @@ public final class WeatherCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { if (targetPlayer == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Target_needed); + CommandHandler.sendMessage(sender, translate("commands.execution.need_target")); return; } diff --git a/src/main/java/emu/grasscutter/game/shop/ShopManager.java b/src/main/java/emu/grasscutter/game/shop/ShopManager.java index 7222db816..2c5d014f5 100644 --- a/src/main/java/emu/grasscutter/game/shop/ShopManager.java +++ b/src/main/java/emu/grasscutter/game/shop/ShopManager.java @@ -4,13 +4,7 @@ import com.google.gson.reflect.TypeToken; import emu.grasscutter.Grasscutter; import emu.grasscutter.data.GameData; import emu.grasscutter.data.common.ItemParamData; -import emu.grasscutter.data.def.ItemData; import emu.grasscutter.data.def.ShopGoodsData; -import emu.grasscutter.game.inventory.GameItem; -import emu.grasscutter.game.managers.InventoryManager; -import emu.grasscutter.game.props.ActionReason; -import emu.grasscutter.net.proto.ItemParamOuterClass; -import emu.grasscutter.net.proto.ShopGoodsOuterClass; import emu.grasscutter.server.game.GameServer; import emu.grasscutter.utils.Utils; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; @@ -54,9 +48,9 @@ public class ShopManager { public static int getShopNextRefreshTime(ShopInfo shopInfo) { return switch (shopInfo.getShopRefreshType()) { - case SHOP_REFRESH_DAILY -> Utils.GetNextTimestampOfThisHour(REFRESH_HOUR, TIME_ZONE, shopInfo.getShopRefreshParam()); - case SHOP_REFRESH_WEEKLY -> Utils.GetNextTimestampOfThisHourInNextWeek(REFRESH_HOUR, TIME_ZONE, shopInfo.getShopRefreshParam()); - case SHOP_REFRESH_MONTHLY -> Utils.GetNextTimestampOfThisHourInNextMonth(REFRESH_HOUR, TIME_ZONE, shopInfo.getShopRefreshParam()); + case SHOP_REFRESH_DAILY -> Utils.getNextTimestampOfThisHour(REFRESH_HOUR, TIME_ZONE, shopInfo.getShopRefreshParam()); + case SHOP_REFRESH_WEEKLY -> Utils.getNextTimestampOfThisHourInNextWeek(REFRESH_HOUR, TIME_ZONE, shopInfo.getShopRefreshParam()); + case SHOP_REFRESH_MONTHLY -> Utils.getNextTimestampOfThisHourInNextMonth(REFRESH_HOUR, TIME_ZONE, shopInfo.getShopRefreshParam()); default -> 0; }; } diff --git a/src/main/java/emu/grasscutter/plugin/api/PlayerHook.java b/src/main/java/emu/grasscutter/plugin/api/PlayerHook.java index 3760ea42c..6b68b7622 100644 --- a/src/main/java/emu/grasscutter/plugin/api/PlayerHook.java +++ b/src/main/java/emu/grasscutter/plugin/api/PlayerHook.java @@ -28,6 +28,7 @@ public final class PlayerHook { /** * Kicks a player from the server. + * TODO: Refactor to kick using a packet. */ public void kick() { this.player.getSession().close(); diff --git a/src/main/java/emu/grasscutter/server/dispatch/DispatchHttpJsonHandler.java b/src/main/java/emu/grasscutter/server/dispatch/DispatchHttpJsonHandler.java index e1a07b412..54ee38988 100644 --- a/src/main/java/emu/grasscutter/server/dispatch/DispatchHttpJsonHandler.java +++ b/src/main/java/emu/grasscutter/server/dispatch/DispatchHttpJsonHandler.java @@ -2,6 +2,7 @@ package emu.grasscutter.server.dispatch; import java.io.IOException; import java.util.Arrays; +import java.util.Objects; import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter.ServerDebugMode; @@ -9,6 +10,8 @@ import express.http.HttpContextHandler; import express.http.Request; import express.http.Response; +import static emu.grasscutter.utils.Language.translate; + public final class DispatchHttpJsonHandler implements HttpContextHandler { private final String response; private final String[] missingRoutes = { // TODO: When http requests for theses routes are found please remove it from this list and update the route request type in the DispatchServer @@ -31,8 +34,8 @@ public final class DispatchHttpJsonHandler implements HttpContextHandler { @Override public void handle(Request req, Response res) throws IOException { // Checking for ALL here isn't required as when ALL is enabled enableDevLogging() gets enabled - if(Grasscutter.getConfig().DebugMode == ServerDebugMode.MISSING && Arrays.stream(missingRoutes).anyMatch(x -> x == req.baseUrl())) { - Grasscutter.getLogger().info(Grasscutter.getLanguage().Client_request.replace("{ip}", req.ip()).replace("{method}", req.method()).replace("{url}", req.baseUrl()) + (Grasscutter.getConfig().DebugMode == ServerDebugMode.MISSING ? "(MISSING)" : "")); + if(Grasscutter.getConfig().DebugMode == ServerDebugMode.MISSING && Arrays.stream(missingRoutes).anyMatch(x -> Objects.equals(x, req.baseUrl()))) { + Grasscutter.getLogger().info(translate("messages.dispatch.request", req.ip(), req.method(), req.baseUrl()) + (Grasscutter.getConfig().DebugMode == ServerDebugMode.MISSING ? "(MISSING)" : "")); } res.send(response); } diff --git a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java index 196faf880..21ef3ef69 100644 --- a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java +++ b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java @@ -33,6 +33,8 @@ import java.io.*; import java.net.URLDecoder; import java.util.*; +import static emu.grasscutter.utils.Language.translate; + public final class DispatchServer { public static String query_region_list = ""; public static String query_cur_region = ""; @@ -211,21 +213,21 @@ public final class DispatchServer { sslContextFactory.setKeyStorePassword(Grasscutter.getConfig().getDispatchOptions().KeystorePassword); } catch (Exception e) { e.printStackTrace(); - Grasscutter.getLogger().warn(Grasscutter.getLanguage().Not_load_keystore); + Grasscutter.getLogger().warn(translate("messages.dispatch.keystore.password_error")); try { sslContextFactory.setKeyStorePath(keystoreFile.getPath()); sslContextFactory.setKeyStorePassword("123456"); - Grasscutter.getLogger().warn(Grasscutter.getLanguage().Use_default_keystore); + Grasscutter.getLogger().warn(translate("messages.dispatch.keystore.default_password")); } catch (Exception e2) { - Grasscutter.getLogger().warn(Grasscutter.getLanguage().Load_keystore_error); + Grasscutter.getLogger().warn(translate("messages.dispatch.keystore.general_error")); e2.printStackTrace(); } } serverConnector = new ServerConnector(server, sslContextFactory); } else { - Grasscutter.getLogger().warn(Grasscutter.getLanguage().Not_find_ssl_cert); + Grasscutter.getLogger().warn(translate("messages.dispatch.keystore.no_keystore_error")); Grasscutter.getConfig().getDispatchOptions().UseSSL = false; serverConnector = new ServerConnector(server); @@ -245,11 +247,11 @@ public final class DispatchServer { } }); - httpServer.get("/", (req, res) -> res.send(Grasscutter.getLanguage().Welcome)); + httpServer.get("/", (req, res) -> res.send(translate("messages.status.welcome"))); httpServer.raw().error(404, ctx -> { if(Grasscutter.getConfig().DebugMode == ServerDebugMode.MISSING) { - Grasscutter.getLogger().info(Grasscutter.getLanguage().Potential_unhandled_request.replace("{method}", ctx.method()).replace("{url}", ctx.url())); + Grasscutter.getLogger().info(translate("messages.dispatch.unhandled_request_error", ctx.method(), ctx.url())); } ctx.contentType("text/html"); ctx.result("<!doctype html><html lang=\"en\"><body><img src=\"https://http.cat/404\" /></body></html>"); // I'm like 70% sure this won't break anything. @@ -307,7 +309,7 @@ public final class DispatchServer { if (requestData == null) { return; } - Grasscutter.getLogger().info(Grasscutter.getLanguage().Client_try_login.replace("{ip}", req.ip())); + Grasscutter.getLogger().info(translate("messages.dispatch.account.login_attempt", req.ip())); res.send(this.getAuthHandler().handleGameLogin(req, requestData)); }); @@ -327,7 +329,7 @@ public final class DispatchServer { return; } LoginResultJson responseData = new LoginResultJson(); - Grasscutter.getLogger().info(Grasscutter.getLanguage().Client_login_token.replace("{ip}", req.ip())); + Grasscutter.getLogger().info(translate("messages.dispatch.account.login_token_attempt")); // Login Account account = DatabaseHelper.getAccountById(requestData.uid); @@ -335,16 +337,16 @@ public final class DispatchServer { // Test if (account == null || !account.getSessionKey().equals(requestData.token)) { responseData.retcode = -111; - responseData.message = Grasscutter.getLanguage().Game_account_cache_error; + responseData.message = translate("messages.dispatch.account.account_cache_error"); - Grasscutter.getLogger().info(Grasscutter.getLanguage().Client_token_login_failed.replace("{ip}", req.ip())); + Grasscutter.getLogger().info(translate("messages.dispatch.account.login_token_error", req.ip())); } else { responseData.message = "OK"; responseData.data.account.uid = requestData.uid; responseData.data.account.token = requestData.token; responseData.data.account.email = account.getEmail(); - Grasscutter.getLogger().info(Grasscutter.getLanguage().Client_login_in_token.replace("{ip}", req.ip()).replace("{uid}", responseData.data.account.uid)); + Grasscutter.getLogger().info(translate("messages.dispatch.account.login_token_success", req.ip(), requestData.uid)); } res.send(responseData); @@ -374,16 +376,16 @@ public final class DispatchServer { // Test if (account == null || !account.getSessionKey().equals(loginData.token)) { responseData.retcode = -201; - responseData.message = Grasscutter.getLanguage().Wrong_session_key; + responseData.message = translate("messages.dispatch.account.session_key_error"); - Grasscutter.getLogger().info(Grasscutter.getLanguage().Client_failed_exchange_combo_token.replace("{ip}", req.ip())); + Grasscutter.getLogger().info(translate("messages.dispatch.account.combo_token_error", req.ip())); } else { responseData.message = "OK"; responseData.data.open_id = loginData.uid; responseData.data.combo_id = "157795300"; responseData.data.combo_token = account.generateLoginToken(); - Grasscutter.getLogger().info(Grasscutter.getLanguage().Client_exchange_combo_token.replace("{ip}", req.ip())); + Grasscutter.getLogger().info(translate("messages.dispatch.account.combo_token_success", req.ip())); } res.send(responseData); @@ -449,7 +451,7 @@ public final class DispatchServer { httpServer.get("/gcstatic/*", new StaticFileHandler()); httpServer.listen(Grasscutter.getConfig().getDispatchOptions().Port); - Grasscutter.getLogger().info(Grasscutter.getLanguage().Dispatch_start_server_port.replace("{port}", Integer.toString(httpServer.raw().port()))); + Grasscutter.getLogger().info(translate("messages.dispatch.port_bind", Integer.toString(httpServer.raw().port()))); } private Map<String, String> parseQueryString(String qs) { diff --git a/src/main/java/emu/grasscutter/server/game/GameServer.java b/src/main/java/emu/grasscutter/server/game/GameServer.java index db4a8c32b..f414a69ff 100644 --- a/src/main/java/emu/grasscutter/server/game/GameServer.java +++ b/src/main/java/emu/grasscutter/server/game/GameServer.java @@ -29,6 +29,8 @@ import java.time.OffsetDateTime; import java.util.*; import java.util.concurrent.ConcurrentHashMap; +import static emu.grasscutter.utils.Language.translate; + public final class GameServer extends KcpServer { private final InetSocketAddress address; private final GameServerPacketHandler packetHandler; @@ -48,6 +50,13 @@ public final class GameServer extends KcpServer { private final CombineManger combineManger; + public GameServer() { + this(new InetSocketAddress( + Grasscutter.getConfig().getGameServerOptions().Ip, + Grasscutter.getConfig().getGameServerOptions().Port + )); + } + public GameServer(InetSocketAddress address) { super(address); @@ -76,7 +85,7 @@ public final class GameServer extends KcpServer { try { onTick(); } catch (Exception e) { - Grasscutter.getLogger().error(Grasscutter.getLanguage().An_error_occurred_during_game_update, e); + Grasscutter.getLogger().error(translate("messages.game.game_update_error"), e); } } }, new Date(), 1000L); @@ -214,8 +223,8 @@ public final class GameServer extends KcpServer { @Override public void onStartFinish() { - Grasscutter.getLogger().info(Grasscutter.getLanguage().Grasscutter_is_free); - Grasscutter.getLogger().info(Grasscutter.getLanguage().Game_start_port.replace("{port}", Integer.toString(address.getPort()))); + Grasscutter.getLogger().info(translate("messages.status.free_software")); + Grasscutter.getLogger().info(translate("messages.game.port_bind", Integer.toString(address.getPort()))); ServerStartEvent event = new ServerStartEvent(ServerEvent.Type.GAME, OffsetDateTime.now()); event.call(); } diff --git a/src/main/java/emu/grasscutter/server/game/GameSession.java b/src/main/java/emu/grasscutter/server/game/GameSession.java index ff024b03b..476f9bf4a 100644 --- a/src/main/java/emu/grasscutter/server/game/GameSession.java +++ b/src/main/java/emu/grasscutter/server/game/GameSession.java @@ -22,6 +22,8 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; +import static emu.grasscutter.utils.Language.translate; + public class GameSession extends KcpChannel { private GameServer server; @@ -113,21 +115,21 @@ public class GameSession extends KcpChannel { @Override protected void onConnect() { - Grasscutter.getLogger().info(Grasscutter.getLanguage().Client_connect.replace("{address}", getAddress().getHostString().toLowerCase())); + Grasscutter.getLogger().info(translate("messages.game.connect", this.getAddress().getHostString().toLowerCase())); } @Override - protected synchronized void onDisconnect() { // Synchronize so we dont add character at the same time - Grasscutter.getLogger().info(Grasscutter.getLanguage().Client_disconnect.replace("{address}", getAddress().getHostString().toLowerCase())); + protected synchronized void onDisconnect() { // Synchronize so we don't add character at the same time. + Grasscutter.getLogger().info(translate("messages.game.disconnect", this.getAddress().getHostString().toLowerCase())); // Set state so no more packets can be handled this.setState(SessionState.INACTIVE); // Save after disconnecting if (this.isLoggedIn()) { - // Save + // Call logout event. getPlayer().onLogout(); - // Remove from gameserver + // Remove from server. getServer().getPlayers().remove(getPlayer().getUid()); } } diff --git a/src/main/java/emu/grasscutter/tools/Tools.java b/src/main/java/emu/grasscutter/tools/Tools.java index d7f5e986a..efd7b8f93 100644 --- a/src/main/java/emu/grasscutter/tools/Tools.java +++ b/src/main/java/emu/grasscutter/tools/Tools.java @@ -93,6 +93,7 @@ public final class Tools { } Grasscutter.getLogger().info("GM Handbook generated!"); + System.exit(0); } @SuppressWarnings("deprecation") @@ -184,6 +185,8 @@ public final class Tools { writer.println(",\"200\": \"Standard\", \"301\": \"Avatar Event\", \"302\": \"Weapon event\""); writer.println("}\n}"); } + Grasscutter.getLogger().info("Mappings generated!"); + System.exit(0); } } diff --git a/src/main/java/emu/grasscutter/utils/Utils.java b/src/main/java/emu/grasscutter/utils/Utils.java index 1b4a00b90..268cc6f40 100644 --- a/src/main/java/emu/grasscutter/utils/Utils.java +++ b/src/main/java/emu/grasscutter/utils/Utils.java @@ -15,6 +15,8 @@ import io.netty.buffer.Unpooled; import org.slf4j.Logger; +import static emu.grasscutter.utils.Language.translate; + @SuppressWarnings({"UnusedReturnValue", "BooleanMethodIsAlwaysInverted"}) public final class Utils { public static final Random random = new Random(); @@ -176,15 +178,15 @@ public final class Utils { // Check for resources folder. if(!fileExists(resourcesFolder)) { - logger.info(Grasscutter.getLanguage().Create_resources_folder); - logger.info(Grasscutter.getLanguage().Place_copy); + logger.info(translate("messages.status.create_resources")); + logger.info(translate("messages.status.resources_error")); createFolder(resourcesFolder); exit = true; } - // Check for BinOutput + ExcelBinOuput. + // Check for BinOutput + ExcelBinOutput. if(!fileExists(resourcesFolder + "BinOutput") || !fileExists(resourcesFolder + "ExcelBinOutput")) { - logger.info(Grasscutter.getLanguage().Place_copy); + logger.info(translate("messages.status.resources_error")); exit = true; } @@ -195,7 +197,11 @@ public final class Utils { if(exit) System.exit(1); } - public static int GetNextTimestampOfThisHour(int hour, String timeZone, int param) { + /** + * Gets the timestamp of the next hour. + * @return The timestamp in UNIX seconds. + */ + public static int getNextTimestampOfThisHour(int hour, String timeZone, int param) { ZonedDateTime zonedDateTime = ZonedDateTime.now(ZoneId.of(timeZone)); for (int i = 0; i < param; i ++){ if (zonedDateTime.getHour() < hour) { @@ -204,10 +210,14 @@ public final class Utils { zonedDateTime = zonedDateTime.plusDays(1).withHour(hour).withMinute(0).withSecond(0); } } - return (int)zonedDateTime.toInstant().atZone(ZoneOffset.UTC).toEpochSecond(); + return (int) zonedDateTime.toInstant().atZone(ZoneOffset.UTC).toEpochSecond(); } - public static int GetNextTimestampOfThisHourInNextWeek(int hour, String timeZone, int param) { + /** + * Gets the timestamp of the next hour in a week. + * @return The timestamp in UNIX seconds. + */ + public static int getNextTimestampOfThisHourInNextWeek(int hour, String timeZone, int param) { ZonedDateTime zonedDateTime = ZonedDateTime.now(ZoneId.of(timeZone)); for (int i = 0; i < param; i++) { if (zonedDateTime.getDayOfWeek() == DayOfWeek.MONDAY && zonedDateTime.getHour() < hour) { @@ -216,10 +226,14 @@ public final class Utils { zonedDateTime = zonedDateTime.with(TemporalAdjusters.next(DayOfWeek.MONDAY)).withHour(hour).withMinute(0).withSecond(0); } } - return (int)zonedDateTime.toInstant().atZone(ZoneOffset.UTC).toEpochSecond(); + return (int) zonedDateTime.toInstant().atZone(ZoneOffset.UTC).toEpochSecond(); } - public static int GetNextTimestampOfThisHourInNextMonth(int hour, String timeZone, int param) { + /** + * Gets the timestamp of the next hour in a month. + * @return The timestamp in UNIX seconds. + */ + public static int getNextTimestampOfThisHourInNextMonth(int hour, String timeZone, int param) { ZonedDateTime zonedDateTime = ZonedDateTime.now(ZoneId.of(timeZone)); for (int i = 0; i < param; i++) { if (zonedDateTime.getDayOfMonth() == 1 && zonedDateTime.getHour() < hour) { @@ -228,6 +242,22 @@ public final class Utils { zonedDateTime = zonedDateTime.with(TemporalAdjusters.firstDayOfNextMonth()).withHour(hour).withMinute(0).withSecond(0); } } - return (int)zonedDateTime.toInstant().atZone(ZoneOffset.UTC).toEpochSecond(); + return (int) zonedDateTime.toInstant().atZone(ZoneOffset.UTC).toEpochSecond(); + } + + /** + * Retrieves a string from an input stream. + * @param stream The input stream. + * @return The string. + */ + public static String readFromInputStream(InputStream stream) { + StringBuilder stringBuilder = new StringBuilder(); + try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) { + String line; while ((line = reader.readLine()) != null) { + stringBuilder.append(line); + } stream.close(); + } catch (IOException e) { + Grasscutter.getLogger().warn("Failed to read from input stream."); + } return stringBuilder.toString(); } } diff --git a/src/main/resources/languages/en_US.json b/src/main/resources/languages/en_US.json new file mode 100644 index 000000000..f2f6b59ec --- /dev/null +++ b/src/main/resources/languages/en_US.json @@ -0,0 +1,295 @@ +{ + "messages": { + "game": { + "port_bind": "Game Server started on port %s", + "connect": "Client connected from %s", + "disconnect": "Client disconnected from %s", + "game_update_error": "An error occurred during game update.", + "command_error": "Command error:" + }, + "dispatch": { + "port_bind": "[Dispatch] Dispatch server started on port %s", + "request": "[Dispatch] Client %s %s request: %s", + "keystore": { + "general_error": "[Dispatch] Error while loading keystore!", + "password_error": "[Dispatch] Unable to load keystore. Trying default keystore password...", + "no_keystore_error": "[Dispatch] No SSL cert found! Falling back to HTTP server.", + "default_password": "[Dispatch] The default keystore password was loaded successfully. Please consider setting the password to 123456 in config.json." + }, + "no_commands_error": "Commands are not supported in dispatch only mode.", + "unhandled_request_error": "[Dispatch] Potential unhandled %s request: %s", + "account": { + "login_attempt": "[Dispatch] Client %s is trying to log in", + "login_success": "[Dispatch] Client %s logged in as %s", + "login_token_attempt": "[Dispatch] Client %s is trying to log in via token", + "login_token_error": "[Dispatch] Client %s failed to log in via token", + "login_token_success": "[Dispatch] Client %s logged in via token as %s", + "combo_token_success": "[Dispatch] Client %s succeed to exchange combo token", + "combo_token_error": "[Dispatch] Client %s failed to exchange combo token", + "account_login_create_success": "[Dispatch] Client %s failed to log in: Account %s created", + "account_login_create_error": "[Dispatch] Client %s failed to log in: Account create failed", + "account_login_exist_error": "[Dispatch] Client %s failed to log in: Account no found", + "account_cache_error": "Game account cache information error", + "session_key_error": "Wrong session key.", + "username_error": "Username not found.", + "username_create_error": "Username not found, create failed." + } + }, + "status": { + "free_software": "Grasscutter is FREE software. If you have paid for this, you may have been scammed. Homepage: https://github.com/Grasscutters/Grasscutter", + "starting": "Starting Grasscutter...", + "shutdown": "Shutting down...", + "done": "Done! For help, type \"help\"", + "error": "An error occurred.", + "welcome": "Welcome to Grasscutter", + "run_mode_error": "Invalid server run mode: %s.", + "run_mode_help": "Server run mode must be 'HYBRID', 'DISPATCH_ONLY', or 'GAME_ONLY'. Unable to start Grasscutter...", + "create_resources": "Creating resources folder...", + "resources_error": "Place a copy of 'BinOutput' and 'ExcelBinOutput' in the resources folder." + } + }, + "commands": { + "generic": { + "not_specified": "No command specified.", + "unknown_command": "Unknown command: %s", + "permission_error": "You do not have permission to run this command.", + "console_execute_error": "This command can only be run from the console.", + "player_execute_error": "Run this command in-game.", + "command_exist_error": "No command found.", + "invalid": { + "amount": "Invalid amount.", + "artifactId": "Invalid artifactId.", + "avatarId": "Invalid avatarId.", + "avatarLevel": "Invalid avatarLevel.", + "entityId": "Invalid entityId.", + "itemId": "Invalid itemId.", + "itemLevel": "Invalid itemLevel.", + "itemRefinement": "Invalid itemRefinement.", + "playerId": "Invalid playerId.", + "uid": "Invalid UID." + } + }, + "execution": { + "uid_error": "Invalid UID.", + "player_exist_error": "Player not found.", + "player_offline_error": "Player is not online.", + "item_id_error": "Invalid item ID.", + "item_player_exist_error": "Invalid item or UID.", + "entity_id_error": "Invalid entity ID.", + "player_exist_offline_error": "Player not found or is not online.", + "argument_error": "Invalid arguments.", + "clear_target": "Target cleared.", + "set_target": "Subsequent commands will target @%s by default.", + "need_target": "This command requires a target UID. Add a <@UID> argument or set a persistent target with /target @UID." + }, + "status": { + "enabled": "Enabled", + "disabled": "Disabled", + "help": "Help", + "success": "Success" + }, + "account": { + "modify": "Modify user accounts", + "invalid": "Invalid UID.", + "exists": "Account already exists.", + "create": "Account created with UID %s.", + "delete": "Account deleted.", + "no_account": "Account not found.", + "command_usage": "Usage: account <create|delete> <username> [uid]" + }, + "broadcast": { + "command_usage": "Usage: broadcast <message>", + "message_sent": "Message sent." + }, + "changescene": { + "usage": "Usage: changescene <sceneId>", + "already_in_scene": "You are already in that scene.", + "success": "Changed to scene %s.", + "exists_error": "The specified scene does not exist." + }, + "clear": { + "command_usage": "Usage: clear <all|wp|art|mat>", + "weapons": "Cleared weapons for %s.", + "artifacts": "Cleared artifacts for %s.", + "materials": "Cleared materials for %s.", + "furniture": "Cleared furniture for %s.", + "displays": "Cleared displays for %s.", + "virtuals": "Cleared virtuals for %s.", + "everything": "Cleared everything for %s." + }, + "coop": { + "usage": "Usage: coop <playerId> <target playerId>" + }, + "enter_dungeon": { + "usage": "Usage: enterdungeon <dungeon id>", + "changed": "Changed to dungeon %s", + "not_found_error": "Dungeon does not exist", + "in_dungeon_error": "You are already in that dungeon" + }, + "giveAll": { + "usage": "Usage: giveall [player] [amount]", + "item": "Giving all items...", + "done": "Giving all items done", + "invalid_amount_or_playerId": "Invalid amount or player ID." + }, + "giveArtifact": { + "usage": "Usage: giveart|gart [player] <artifactId> <mainPropId> [<appendPropId>[,<times>]]... [level]", + "invalid_artifact_id": "Invalid artifact ID.", + "given": "Given %s to %s." + }, + "giveChar": { + "usage": "Usage: givechar <player> <itemId|itemName> [amount]", + "given": "Given %s with level %s to %s.", + "invalid_avatar_id": "Invalid avatar id.", + "invalid_avatar_level": "Invalid avatar level.", + "invalid_avatar_or_player_id": "Invalid avatar or player ID." + }, + "give": { + "usage": "Usage: give <player> <itemId|itemName> [amount] [level]", + "refinement_only_applicable_weapons": "Refinement is only applicable to weapons.", + "refinement_must_between_1_and_5": "Refinement must be between 1 and 5.", + "given": "Given %s of %s to %s.", + "given_with_level_and_refinement": "Given %s with level %s, refinement %s %s times to %s", + "given_level": "Given %s with level %s %s times to %s" + }, + "godmode": { + "success": "Godmode is now %s for %s." + }, + "heal": { + "success": "All characters have been healed." + }, + "kick": { + "player_kick_player": "Player [%s:%s] has kicked player [%s:%s]", + "server_kick_player": "Kicking player [%s:%s]" + }, + "kill": { + "usage": "Usage: killall [playerUid] [sceneId]", + "scene_not_found_in_player_world": "Scene not found in player world", + "kill_monsters_in_scene": "Killing %s monsters in scene %s" + }, + "killCharacter": { + "usage": "Usage: /killcharacter [playerId]", + "current_character": "Killed %s current character." + }, + "list": { + "message": "There are %s player(s) online:" + }, + "permission": { + "usage": "Usage: permission <add|remove> <username> <permission>", + "add": "Permission added.", + "have_permission": "They already have this permission!", + "remove": "Permission removed.", + "not_have_permission": "They don't have this permission!" + }, + "position": { + "success": "Coordinates: %.3f, %.3f, %.3f\nScene id: %d" + }, + "reload": { + "reload_start": "Reloading config.", + "reload_done": "Reload complete." + }, + "resetConst": { + "reset_all": "Reset all avatars' constellations.", + "success": "Constellations for %s have been reset. Please relog to see changes." + }, + "resetShopLimit": { + "usage": "Usage: /resetshop <player id>" + }, + "sendMail": { + "usage": "Usage: give [player] <itemId|itemName> [amount]", + "user_not_exist": "The user with an id of '%s' does not exist", + "start_composition": "Starting composition of message.\nPlease use `/sendmail <title>` to continue.\nYou can use `/sendmail stop` at any time", + "templates": "Mail templates coming soon implemented...", + "invalid_arguments": "Invalid arguments.\nUsage `/sendmail <userId|all|help> [templateId]`", + "send_cancel": "Message sending cancelled", + "send_done": "Message sent to user %s!", + "send_all_done": "Message sent to all users!", + "not_composition_end": "Message composition not at final stage.\nPlease use `/sendmail %s` or `/sendmail stop` to cancel", + "please_use": "Please use `/sendmail %s`", + "set_title": "Message title set as '%s'.\nUse '/sendmail <content>' to continue.", + "set_contents": "Message contents set as '%s'.\nUse '/sendmail <sender>' to continue.", + "set_message_sender": "Message sender set as '%s'.\nUse '/sendmail <itemId|itemName|finish> [amount] [level]' to continue.", + "send": "Attached %s of %s (level %s) to the message.\nContinue adding more items or use `/sendmail finish` to send the message.", + "invalid_arguments_please_use": "Invalid arguments \n Please use `/sendmail %s`", + "title": "<title>", + "message": "<message>", + "sender": "<sender>", + "arguments": "<itemId|itemName|finish> [amount] [level]", + "error": "ERROR: invalid construction stage %s. Check console for stacktrace." + }, + "sendMessage": { + "usage": "Usage: sendmessage <player> <message>", + "message_sent": "Message sent." + }, + "setFetterLevel": { + "usage": "Usage: setfetterlevel <level>", + "fetter_level_must_between_0_and_10": "Fetter level must be between 0 and 10.", + "fetter_set_level": "Fetter level set to %s", + "invalid_fetter_level": "Invalid fetter level." + }, + "setStats": { + "usage_console": "Usage: setstats|stats @<UID> <stat> <value>", + "usage_ingame": "Usage: setstats|stats [@UID] <stat> <value>", + "help_message": "\n\tValues for <stat>: hp | maxhp | def | atk | em | er | crate | cdmg | cdr | heal | heali | shield | defi\n\t(cont.) Elemental DMG Bonus: epyro | ecryo | ehydro | egeo | edendro | eelectro | ephys\n\t(cont.) Elemental RES: respyro | rescryo | reshydro | resgeo | resdendro | reselectro | resphys\n", + "value_error": "Invalid stat value.", + "uid_error": "Invalid UID.", + "player_error": "Player not found or offline.", + "set_self": "%s set to %s.", + "set_for_uid": "%s for %s set to %s.", + "set_max_hp": "MAX HP set to %s." + }, + "setWorldLevel": { + "usage": "Usage: setworldlevel <level>", + "world_level_must_between_0_and_8": "World level must be between 0-8", + "set_world_level": "World level set to %s.", + "invalid_world_level": "Invalid world level." + }, + "spawn": { + "usage": "Usage: spawn <entityId> [amount] [level(monster only)]", + "message": "Spawned %s of %s." + }, + "stop": { + "message": "Server shutting down..." + }, + "talent": { + "usage_1": "To set talent level: /talent set <talentID> <value>", + "usage_2": "Another way to set talent level: /talent <n or e or q> <value>", + "usage_3": "To get talent ID: /talent getid", + "lower_16": "Invalid talent level. Level should be lower than 16", + "set_id": "Set talent to %s.", + "set_atk": "Set talent Normal ATK to %s.", + "set_e": "Set talent E to %s.", + "set_q": "Set talent Q to %s.", + "invalid_skill_id": "Invalid skill ID.", + "set_this": "Set this talent to %s.", + "invalid_level": "Invalid talent level.", + "normal_attack_id": "Normal Attack ID %s.", + "e_skill_id": "E skill ID %s.", + "q_skill_id": "Q skill ID %s." + }, + "teleportAll": { + "message": "You only can use this command in MP mode." + }, + "teleport": { + "usage_server": "Usage: /tp @<player id> <x> <y> <z> [scene id]", + "usage": "Usage: /tp [@<player id>] <x> <y> <z> [scene id]", + "specify_player_id": "You must specify a player id.", + "invalid_position": "Invalid position.", + "message": "Teleported %s to %s,%s,%s in scene %s" + }, + "weather": { + "usage": "Usage: weather <weatherId> [climateId]", + "message": "Changed weather to %s with climate %s", + "invalid_id": "Invalid ID." + }, + "drop": { + "command_usage": "Usage: drop <itemId|itemName> [amount]", + "success": "Dropped %s of %s." + }, + "help": { + "usage": "Usage: ", + "aliases": "Aliases: ", + "available_commands": "Available commands: " + } + } +} \ No newline at end of file From 2d325e1847e9f74595be6b41bb611bc7cdbf3cbe Mon Sep 17 00:00:00 2001 From: Bwly999 <438225686@qq.com> Date: Fri, 6 May 2022 18:16:07 +0800 Subject: [PATCH 08/39] fix the problem that the reference of serverHook in Plugin object is null --- .../java/emu/grasscutter/Grasscutter.java | 5 ++- .../grasscutter/server/game/GameServer.java | 33 +++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/main/java/emu/grasscutter/Grasscutter.java b/src/main/java/emu/grasscutter/Grasscutter.java index a1c8a5c7c..81e729b2c 100644 --- a/src/main/java/emu/grasscutter/Grasscutter.java +++ b/src/main/java/emu/grasscutter/Grasscutter.java @@ -92,14 +92,13 @@ public final class Grasscutter { // Database DatabaseManager.initialize(); - // Create plugin manager instance. - pluginManager = new PluginManager(); - // Create server instances. dispatchServer = new DispatchServer(); gameServer = new GameServer(new InetSocketAddress(getConfig().getGameServerOptions().Ip, getConfig().getGameServerOptions().Port)); // Create a server hook instance with both servers. new ServerHook(gameServer, dispatchServer); + // Create plugin manager instance. + pluginManager = new PluginManager(); // Start servers. if (getConfig().RunMode == ServerRunMode.HYBRID) { diff --git a/src/main/java/emu/grasscutter/server/game/GameServer.java b/src/main/java/emu/grasscutter/server/game/GameServer.java index db4a8c32b..0135145c0 100644 --- a/src/main/java/emu/grasscutter/server/game/GameServer.java +++ b/src/main/java/emu/grasscutter/server/game/GameServer.java @@ -28,6 +28,9 @@ import java.net.InetSocketAddress; import java.time.OffsetDateTime; import java.util.*; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; public final class GameServer extends KcpServer { private final InetSocketAddress address; @@ -67,19 +70,6 @@ public final class GameServer extends KcpServer { this.taskMap = new TaskMap(true); this.dropManager = new DropManager(this); this.combineManger = new CombineManger(this); - - // Schedule game loop. - Timer gameLoop = new Timer(); - gameLoop.scheduleAtFixedRate(new TimerTask() { - @Override - public void run() { - try { - onTick(); - } catch (Exception e) { - Grasscutter.getLogger().error(Grasscutter.getLanguage().An_error_occurred_during_game_update, e); - } - } - }, new Date(), 1000L); // Hook into shutdown event. Runtime.getRuntime().addShutdownHook(new Thread(this::onServerShutdown)); @@ -212,6 +202,23 @@ public final class GameServer extends KcpServer { } + @Override + public synchronized void start() { + // Schedule game loop. + ScheduledExecutorService gameLoop = Executors.newScheduledThreadPool(2); + gameLoop.scheduleAtFixedRate(new TimerTask() { + @Override + public void run() { + try { + onTick(); + } catch (Exception e) { + Grasscutter.getLogger().error(Grasscutter.getLanguage().An_error_occurred_during_game_update, e); + } + } + }, 0L, 1000L, TimeUnit.MILLISECONDS); + super.start(); + } + @Override public void onStartFinish() { Grasscutter.getLogger().info(Grasscutter.getLanguage().Grasscutter_is_free); From deee32a0a18aa2865e4a4e2244157fa76b51cb53 Mon Sep 17 00:00:00 2001 From: Muhammad Eko Prasetyo <muhammadekoprasetyo29@gmail.com> Date: Sat, 7 May 2022 03:23:26 +0700 Subject: [PATCH 09/39] add config option to enable cors for dispatchserver (#579) --- src/main/java/emu/grasscutter/Config.java | 2 ++ .../java/emu/grasscutter/server/dispatch/DispatchServer.java | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/emu/grasscutter/Config.java b/src/main/java/emu/grasscutter/Config.java index e7536b588..c911a1cf0 100644 --- a/src/main/java/emu/grasscutter/Config.java +++ b/src/main/java/emu/grasscutter/Config.java @@ -41,6 +41,8 @@ public final class Config { public String KeystorePassword = "123456"; public Boolean UseSSL = true; public Boolean FrontHTTPS = true; + public Boolean CORS = false; + public String[] CORSAllowedOrigins = new String[] { "*" }; public boolean AutomaticallyCreateAccounts = false; public String[] defaultPermissions = new String[] { "" }; diff --git a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java index 85f02a36d..737193fbd 100644 --- a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java +++ b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java @@ -245,8 +245,11 @@ public final class DispatchServer { if(Grasscutter.getConfig().DebugMode == ServerDebugMode.ALL) { config.enableDevLogging(); } + if (Grasscutter.getConfig().getDispatchOptions().CORS){ + if (Grasscutter.getConfig().getDispatchOptions().CORSAllowedOrigins.length > 0) config.enableCorsForOrigin(Grasscutter.getConfig().getDispatchOptions().CORSAllowedOrigins); + else config.enableCorsForAllOrigins(); + } }); - httpServer.get("/", (req, res) -> res.send(Grasscutter.getLanguage().Welcome)); httpServer.raw().error(404, ctx -> { From 8abd3ace6cce551a2e6d93bc8906ff982754f054 Mon Sep 17 00:00:00 2001 From: Kinesis <CCasusensa@users.noreply.github.com> Date: Fri, 6 May 2022 22:40:16 +0800 Subject: [PATCH 10/39] Implement Avatar Expedition System MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: ShigemoriHakura <62388797+ShigemoriHakura@users.noreply.github.com> Co-Authored-By: KanyeWestc <104547412+KanyeWestc@users.noreply.github.com> Co-Authored-By: QAQ 天小络 <72185326+XTL676@users.noreply.github.com> Co-Authored-By: nkxingxh <25559053+nkxingxh@users.noreply.github.com> Co-Authored-By: Yazawazi <47273265+Yazawazi@users.noreply.github.com> Co-Authored-By: wuwuwu223 <81224214+wuwuwu223@users.noreply.github.com> Co-Authored-By: omg-xtao <100690902+omg-xtao@users.noreply.github.com> Co-Authored-By: Sakura <104815797+Sakura@users.noreply.github.com> Co-Authored-By: NewNeko-2022 <104819344+NewNeko-2022@users.noreply.github.com> Co-Authored-By: JimWails <30657653+JimWails@users.noreply.github.com> Co-Authored-By: buttercookies <19878609+ButterCookies@users.noreply.github.com> --- data/ExpeditionReward.json | 112 ++++++++++++++++++ .../game/expedition/ExpeditionInfo.java | 44 +++++++ .../game/expedition/ExpeditionManager.java | 46 +++++++ .../game/expedition/ExpeditionRewardData.java | 18 +++ .../expedition/ExpeditionRewardDataList.java | 15 +++ .../game/expedition/ExpeditionRewardInfo.java | 16 +++ .../emu/grasscutter/game/player/Player.java | 42 +++++++ .../grasscutter/server/game/GameServer.java | 10 +- .../HandlerAvatarExpeditionAllDataReq.java | 15 +++ .../HandlerAvatarExpeditionCallBackReq.java | 25 ++++ .../HandlerAvatarExpeditionGetRewardReq.java | 61 ++++++++++ .../recv/HandlerAvatarExpeditionStartReq.java | 23 ++++ .../PacketAvatarExpeditionAllDataRsp.java | 33 ++++++ .../PacketAvatarExpeditionCallBackRsp.java | 23 ++++ .../PacketAvatarExpeditionDataNotify.java | 29 +++++ .../PacketAvatarExpeditionGetRewardRsp.java | 30 +++++ .../send/PacketAvatarExpeditionStartRsp.java | 23 ++++ 17 files changed, 564 insertions(+), 1 deletion(-) create mode 100644 data/ExpeditionReward.json create mode 100644 src/main/java/emu/grasscutter/game/expedition/ExpeditionInfo.java create mode 100644 src/main/java/emu/grasscutter/game/expedition/ExpeditionManager.java create mode 100644 src/main/java/emu/grasscutter/game/expedition/ExpeditionRewardData.java create mode 100644 src/main/java/emu/grasscutter/game/expedition/ExpeditionRewardDataList.java create mode 100644 src/main/java/emu/grasscutter/game/expedition/ExpeditionRewardInfo.java create mode 100644 src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionAllDataReq.java create mode 100644 src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionCallBackReq.java create mode 100644 src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionGetRewardReq.java create mode 100644 src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionStartReq.java create mode 100644 src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionAllDataRsp.java create mode 100644 src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionCallBackRsp.java create mode 100644 src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionDataNotify.java create mode 100644 src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionGetRewardRsp.java create mode 100644 src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionStartRsp.java diff --git a/data/ExpeditionReward.json b/data/ExpeditionReward.json new file mode 100644 index 000000000..90d9378b6 --- /dev/null +++ b/data/ExpeditionReward.json @@ -0,0 +1,112 @@ +[ + { + "expId": 301, + "expeditionRewardDataList": [ + { + "hourTime": 4, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 625, + "maxCount": 625 + } + ] + }, + { + "hourTime": 8, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 1575, + "maxCount": 1575 + } + ] + }, + { + "hourTime": 12, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 2500, + "maxCount": 2500 + } + ] + }, + { + "hourTime": 20, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 5000, + "maxCount": 5000 + } + ] + } + ] + }, + { + "expId": 305, + "expeditionRewardDataList": [ + { + "hourTime": 4, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100064, + "minCount": 1, + "maxCount": 1 + }, { + "itemId": 101210, + "minCount": 1, + "maxCount": 1 + } + ] + }, + { + "hourTime": 8, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100064, + "minCount": 2, + "maxCount": 4 + }, { + "itemId": 101210, + "minCount": 2, + "maxCount": 4 + } + ] + }, + { + "hourTime": 12, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100064, + "minCount": 4, + "maxCount": 6 + }, { + "itemId": 101210, + "minCount": 4, + "maxCount": 6 + } + ] + }, + { + "hourTime": 20, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100064, + "minCount": 8, + "maxCount": 12 + }, { + "itemId": 101210, + "minCount": 8, + "maxCount": 12 + } + ] + } + ] + } +] \ No newline at end of file diff --git a/src/main/java/emu/grasscutter/game/expedition/ExpeditionInfo.java b/src/main/java/emu/grasscutter/game/expedition/ExpeditionInfo.java new file mode 100644 index 000000000..867d692cf --- /dev/null +++ b/src/main/java/emu/grasscutter/game/expedition/ExpeditionInfo.java @@ -0,0 +1,44 @@ +package emu.grasscutter.game.expedition; + +import dev.morphia.annotations.Entity; + +@Entity +public class ExpeditionInfo { + + public int getState() { + return state; + } + + public void setState(int state) { + this.state = state; + } + + public int getExpId() { + return expId; + } + + public void setExpId(int expId) { + this.expId = expId; + } + + public int getHourTime() { + return hourTime; + } + + public void setHourTime(int hourTime) { + this.hourTime = hourTime; + } + + public int getStartTime() { + return startTime; + } + + public void setStartTime(int startTime) { + this.startTime = startTime; + } + + private int state; + private int expId; + private int hourTime; + private int startTime; +} diff --git a/src/main/java/emu/grasscutter/game/expedition/ExpeditionManager.java b/src/main/java/emu/grasscutter/game/expedition/ExpeditionManager.java new file mode 100644 index 000000000..5d1b652e1 --- /dev/null +++ b/src/main/java/emu/grasscutter/game/expedition/ExpeditionManager.java @@ -0,0 +1,46 @@ +package emu.grasscutter.game.expedition; + +import com.google.gson.reflect.TypeToken; +import emu.grasscutter.Grasscutter; +import emu.grasscutter.server.game.GameServer; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; + +import java.io.FileReader; +import java.util.Collection; +import java.util.List; + +public class ExpeditionManager { + public GameServer getGameServer() { + return gameServer; + } + + private final GameServer gameServer; + + public Int2ObjectMap<List<ExpeditionRewardDataList>> getExpeditionRewardDataList() { return expeditionRewardData; } + + private final Int2ObjectMap<List<ExpeditionRewardDataList>> expeditionRewardData; + + public ExpeditionManager(GameServer gameServer) { + this.gameServer = gameServer; + this.expeditionRewardData = new Int2ObjectOpenHashMap<>(); + this.load(); + } + + public synchronized void load() { + try (FileReader fileReader = new FileReader(Grasscutter.getConfig().DATA_FOLDER + "ExpeditionReward.json")) { + getExpeditionRewardDataList().clear(); + List<ExpeditionRewardInfo> banners = Grasscutter.getGsonFactory().fromJson(fileReader, TypeToken.getParameterized(Collection.class, ExpeditionRewardInfo.class).getType()); + if(banners.size() > 0) { + for (ExpeditionRewardInfo di : banners) { + getExpeditionRewardDataList().put(di.getExpId(), di.getExpeditionRewardDataList()); + } + Grasscutter.getLogger().info("Expedition reward successfully loaded."); + } else { + Grasscutter.getLogger().error("Unable to load expedition reward. Expedition reward size is 0."); + } + } catch (Exception e) { + Grasscutter.getLogger().error("Unable to load expedition reward.", e); + } + } +} diff --git a/src/main/java/emu/grasscutter/game/expedition/ExpeditionRewardData.java b/src/main/java/emu/grasscutter/game/expedition/ExpeditionRewardData.java new file mode 100644 index 000000000..ded817a3e --- /dev/null +++ b/src/main/java/emu/grasscutter/game/expedition/ExpeditionRewardData.java @@ -0,0 +1,18 @@ +package emu.grasscutter.game.expedition; + +public class ExpeditionRewardData { + private int itemId; + private int minCount; + private int maxCount; + + public int getItemId() { + return itemId; + } + + public int getMinCount() { return minCount; } + + public int getMaxCount() { + return maxCount; + } + +} diff --git a/src/main/java/emu/grasscutter/game/expedition/ExpeditionRewardDataList.java b/src/main/java/emu/grasscutter/game/expedition/ExpeditionRewardDataList.java new file mode 100644 index 000000000..27a7534e2 --- /dev/null +++ b/src/main/java/emu/grasscutter/game/expedition/ExpeditionRewardDataList.java @@ -0,0 +1,15 @@ +package emu.grasscutter.game.expedition; + +import java.util.List; + +public class ExpeditionRewardDataList { + public int getHourTime() { + return hourTime; + } + public List<ExpeditionRewardData> getExpeditionRewardData() { + return expeditionRewardData; + } + + private int hourTime; + private List<ExpeditionRewardData> expeditionRewardData; +} diff --git a/src/main/java/emu/grasscutter/game/expedition/ExpeditionRewardInfo.java b/src/main/java/emu/grasscutter/game/expedition/ExpeditionRewardInfo.java new file mode 100644 index 000000000..4e0039ff9 --- /dev/null +++ b/src/main/java/emu/grasscutter/game/expedition/ExpeditionRewardInfo.java @@ -0,0 +1,16 @@ +package emu.grasscutter.game.expedition; + +import java.util.List; + +public class ExpeditionRewardInfo { + public int getExpId() { + return expId; + } + + public List<ExpeditionRewardDataList> getExpeditionRewardDataList() { + return expeditionRewardDataList; + } + + private int expId; + private List<ExpeditionRewardDataList> expeditionRewardDataList; +} diff --git a/src/main/java/emu/grasscutter/game/player/Player.java b/src/main/java/emu/grasscutter/game/player/Player.java index b93baccf8..6b01c18f6 100644 --- a/src/main/java/emu/grasscutter/game/player/Player.java +++ b/src/main/java/emu/grasscutter/game/player/Player.java @@ -14,6 +14,7 @@ import emu.grasscutter.game.avatar.AvatarStorage; import emu.grasscutter.game.entity.EntityGadget; import emu.grasscutter.game.entity.EntityItem; import emu.grasscutter.game.entity.GameEntity; +import emu.grasscutter.game.expedition.ExpeditionInfo; import emu.grasscutter.game.friends.FriendsList; import emu.grasscutter.game.friends.PlayerProfile; import emu.grasscutter.game.gacha.PlayerGachaInfo; @@ -50,6 +51,7 @@ import emu.grasscutter.server.packet.send.*; import emu.grasscutter.utils.DateHelper; import emu.grasscutter.utils.Position; import emu.grasscutter.utils.MessageHandler; +import emu.grasscutter.utils.Utils; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; @@ -101,6 +103,7 @@ public class Player { private ArrayList<AvatarProfileData> shownAvatars; private Set<Integer> rewardedLevels; private ArrayList<ShopLimit> shopLimit; + private Map<Long, ExpeditionInfo> expeditionInfo; private int sceneId; private int regionId; @@ -170,6 +173,7 @@ public class Player { this.moonCardGetTimes = new HashSet<>(); this.shopLimit = new ArrayList<>(); + this.expeditionInfo = new HashMap<>(); this.messageHandler = null; this.mapMarksManager = new MapMarksManager(); this.movementManager = new MovementManager(this); @@ -673,6 +677,28 @@ public class Player { session.send(new PacketCardProductRewardNotify(getMoonCardRemainDays())); } + public Map<Long, ExpeditionInfo> getExpeditionInfo() { + return expeditionInfo; + } + + public void addExpeditionInfo(long avaterGuid, int expId, int hourTime, int startTime){ + ExpeditionInfo exp = new ExpeditionInfo(); + exp.setExpId(expId); + exp.setHourTime(hourTime); + exp.setState(1); + exp.setStartTime(startTime); + expeditionInfo.put(avaterGuid, exp); + } + + public void removeExpeditionInfo(long avaterGuid){ + expeditionInfo.remove(avaterGuid); + } + + public ExpeditionInfo getExpeditionInfo(long avaterGuid){ + return expeditionInfo.get(avaterGuid); + } + + public List<ShopLimit> getShopLimit() { return shopLimit; } @@ -1029,6 +1055,22 @@ public class Player { this.resetSendPlayerLocTime(); } } + // Expedition + var timeNow = Utils.getCurrentSeconds(); + var needNotify = false; + for (Long key : expeditionInfo.keySet()) { + ExpeditionInfo e = expeditionInfo.get(key); + if(e.getState() == 1){ + if(timeNow - e.getStartTime() >= e.getHourTime() * 60 * 60){ + e.setState(2); + needNotify = true; + } + } + } + if(needNotify){ + this.save(); + this.sendPacket(new PacketAvatarExpeditionDataNotify(this)); + } } diff --git a/src/main/java/emu/grasscutter/server/game/GameServer.java b/src/main/java/emu/grasscutter/server/game/GameServer.java index db4a8c32b..3b5d91837 100644 --- a/src/main/java/emu/grasscutter/server/game/GameServer.java +++ b/src/main/java/emu/grasscutter/server/game/GameServer.java @@ -8,6 +8,7 @@ import emu.grasscutter.game.Account; import emu.grasscutter.game.combine.CombineManger; import emu.grasscutter.game.drop.DropManager; import emu.grasscutter.game.dungeons.DungeonManager; +import emu.grasscutter.game.expedition.ExpeditionManager; import emu.grasscutter.game.gacha.GachaManager; import emu.grasscutter.game.managers.ChatManager; import emu.grasscutter.game.managers.InventoryManager; @@ -42,6 +43,7 @@ public final class GameServer extends KcpServer { private final ShopManager shopManager; private final MultiplayerManager multiplayerManager; private final DungeonManager dungeonManager; + private final ExpeditionManager expeditionManager; private final CommandMap commandMap; private final TaskMap taskMap; private final DropManager dropManager; @@ -66,6 +68,7 @@ public final class GameServer extends KcpServer { this.commandMap = new CommandMap(true); this.taskMap = new TaskMap(true); this.dropManager = new DropManager(this); + this.expeditionManager = new ExpeditionManager(this); this.combineManger = new CombineManger(this); // Schedule game loop. @@ -124,7 +127,11 @@ public final class GameServer extends KcpServer { public DungeonManager getDungeonManager() { return dungeonManager; } - + + public ExpeditionManager getExpeditionManager() { + return expeditionManager; + } + public CommandMap getCommandMap() { return this.commandMap; } @@ -132,6 +139,7 @@ public final class GameServer extends KcpServer { public CombineManger getCombineManger(){ return this.combineManger; } + public TaskMap getTaskMap() { return this.taskMap; } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionAllDataReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionAllDataReq.java new file mode 100644 index 000000000..f1a30ab0d --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionAllDataReq.java @@ -0,0 +1,15 @@ +package emu.grasscutter.server.packet.recv; + +import emu.grasscutter.net.packet.Opcodes; +import emu.grasscutter.net.packet.PacketHandler; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.server.game.GameSession; +import emu.grasscutter.server.packet.send.PacketAvatarExpeditionAllDataRsp; + +@Opcodes(PacketOpcodes.AvatarExpeditionAllDataReq) +public class HandlerAvatarExpeditionAllDataReq extends PacketHandler { + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + session.send(new PacketAvatarExpeditionAllDataRsp(session.getPlayer())); + } +} diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionCallBackReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionCallBackReq.java new file mode 100644 index 000000000..0ac05ed0b --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionCallBackReq.java @@ -0,0 +1,25 @@ +package emu.grasscutter.server.packet.recv; + +import emu.grasscutter.net.packet.Opcodes; +import emu.grasscutter.net.packet.PacketHandler; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.AvatarExpeditionCallBackReqOuterClass.AvatarExpeditionCallBackReq; +import emu.grasscutter.server.game.GameSession; +import emu.grasscutter.server.packet.send.PacketAvatarExpeditionCallBackRsp; +import emu.grasscutter.server.packet.send.PacketAvatarExpeditionStartRsp; +import emu.grasscutter.utils.Utils; + +@Opcodes(PacketOpcodes.AvatarExpeditionCallBackReq) +public class HandlerAvatarExpeditionCallBackReq extends PacketHandler { + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + AvatarExpeditionCallBackReq req = AvatarExpeditionCallBackReq.parseFrom(payload); + + for (int i = 0; i < req.getAvatarGuidCount(); i++) { + session.getPlayer().removeExpeditionInfo(req.getAvatarGuid(i)); + } + + session.getPlayer().save(); + session.send(new PacketAvatarExpeditionCallBackRsp(session.getPlayer())); + } +} diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionGetRewardReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionGetRewardReq.java new file mode 100644 index 000000000..3e3bed9f1 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionGetRewardReq.java @@ -0,0 +1,61 @@ +package emu.grasscutter.server.packet.recv; + +import emu.grasscutter.Grasscutter; +import emu.grasscutter.game.drop.DropData; +import emu.grasscutter.game.expedition.ExpeditionInfo; +import emu.grasscutter.game.expedition.ExpeditionRewardData; +import emu.grasscutter.game.expedition.ExpeditionRewardDataList; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.props.ActionReason; +import emu.grasscutter.net.packet.Opcodes; +import emu.grasscutter.net.packet.PacketHandler; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.AvatarExpeditionGetRewardReqOuterClass.AvatarExpeditionGetRewardReq; +import emu.grasscutter.server.game.GameSession; +import emu.grasscutter.server.packet.send.PacketAvatarExpeditionCallBackRsp; +import emu.grasscutter.server.packet.send.PacketAvatarExpeditionGetRewardRsp; +import emu.grasscutter.server.packet.send.PacketGadgetInteractRsp; +import emu.grasscutter.server.packet.send.PacketItemAddHintNotify; +import emu.grasscutter.utils.Utils; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; + +@Opcodes(PacketOpcodes.AvatarExpeditionGetRewardReq) +public class HandlerAvatarExpeditionGetRewardReq extends PacketHandler { + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + AvatarExpeditionGetRewardReq req = AvatarExpeditionGetRewardReq.parseFrom(payload); + + ExpeditionInfo expInfo = session.getPlayer().getExpeditionInfo(req.getAvatarGuid()); + + List<GameItem> items = new LinkedList<>(); + + if (session.getServer().getExpeditionManager().getExpeditionRewardDataList().containsKey(expInfo.getExpId())) { + for (ExpeditionRewardDataList RewardDataList : session.getServer().getExpeditionManager().getExpeditionRewardDataList().get(expInfo.getExpId())) { + if(RewardDataList.getHourTime() == expInfo.getHourTime()){ + if(!RewardDataList.getExpeditionRewardData().isEmpty()){ + for (ExpeditionRewardData RewardData :RewardDataList.getExpeditionRewardData()) { + int num = RewardData.getMinCount(); + if(RewardData.getMinCount() != RewardData.getMaxCount()){ + num = Utils.randomRange(RewardData.getMinCount(), RewardData.getMaxCount()); + } + items.add(new GameItem(RewardData.getItemId(), num)); + } + } + } + } + } + + session.getPlayer().getInventory().addItems(items); + session.getPlayer().sendPacket(new PacketItemAddHintNotify(items, ActionReason.ExpeditionReward)); + + session.getPlayer().removeExpeditionInfo(req.getAvatarGuid()); + session.getPlayer().save(); + session.send(new PacketAvatarExpeditionGetRewardRsp(session.getPlayer(), items)); + } +} + diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionStartReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionStartReq.java new file mode 100644 index 000000000..74395e30c --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionStartReq.java @@ -0,0 +1,23 @@ +package emu.grasscutter.server.packet.recv; + +import emu.grasscutter.Grasscutter; +import emu.grasscutter.net.packet.Opcodes; +import emu.grasscutter.net.packet.PacketHandler; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.AvatarExpeditionStartReqOuterClass.AvatarExpeditionStartReq; +import emu.grasscutter.server.game.GameSession; +import emu.grasscutter.server.packet.send.PacketAvatarExpeditionStartRsp; +import emu.grasscutter.utils.Utils; + +@Opcodes(PacketOpcodes.AvatarExpeditionStartReq) +public class HandlerAvatarExpeditionStartReq extends PacketHandler { + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + AvatarExpeditionStartReq req = AvatarExpeditionStartReq.parseFrom(payload); + + int startTime = Utils.getCurrentSeconds(); + session.getPlayer().addExpeditionInfo(req.getAvatarGuid(), req.getExpId(), req.getHourTime(), startTime); + session.getPlayer().save(); + session.send(new PacketAvatarExpeditionStartRsp(session.getPlayer())); + } +} diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionAllDataRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionAllDataRsp.java new file mode 100644 index 000000000..e6772f928 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionAllDataRsp.java @@ -0,0 +1,33 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.Grasscutter; +import emu.grasscutter.game.expedition.ExpeditionInfo; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.AvatarExpeditionAllDataRspOuterClass.AvatarExpeditionAllDataRsp; +import emu.grasscutter.net.proto.AvatarExpeditionInfoOuterClass.AvatarExpeditionInfo; + +import java.util.*; + +public class PacketAvatarExpeditionAllDataRsp extends BasePacket { + public PacketAvatarExpeditionAllDataRsp(Player player) { + super(PacketOpcodes.AvatarExpeditionAllDataRsp); + + List<Integer> openExpeditionList = new ArrayList<>(List.of(306,305,304,303,302,301,206,105,204,104,203,103,202,101,102,201,106,205)); + Map<Long, AvatarExpeditionInfo> avatarExpeditionInfoList = new HashMap<Long, AvatarExpeditionInfo>(); + + var expeditionInfo = player.getExpeditionInfo(); + for (Long key : player.getExpeditionInfo().keySet()) { + ExpeditionInfo e = expeditionInfo.get(key); + avatarExpeditionInfoList.put(key, AvatarExpeditionInfo.newBuilder().setStateValue(e.getState()).setExpId(e.getExpId()).setHourTime(e.getHourTime()).setStartTime(e.getStartTime()).build()); + }; + + AvatarExpeditionAllDataRsp.Builder proto = AvatarExpeditionAllDataRsp.newBuilder() + .addAllOpenExpeditionList(openExpeditionList) + .setExpeditionCountLimit(5) + .putAllExpeditionInfoMap(avatarExpeditionInfoList); + + this.setData(proto.build()); + } +} diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionCallBackRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionCallBackRsp.java new file mode 100644 index 000000000..30c927bc9 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionCallBackRsp.java @@ -0,0 +1,23 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.game.expedition.ExpeditionInfo; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.AvatarExpeditionCallBackRspOuterClass.AvatarExpeditionCallBackRsp; +import emu.grasscutter.net.proto.AvatarExpeditionInfoOuterClass.AvatarExpeditionInfo; + +public class PacketAvatarExpeditionCallBackRsp extends BasePacket { + public PacketAvatarExpeditionCallBackRsp(Player player) { + super(PacketOpcodes.AvatarExpeditionCallBackRsp); + + AvatarExpeditionCallBackRsp.Builder proto = AvatarExpeditionCallBackRsp.newBuilder(); + var expeditionInfo = player.getExpeditionInfo(); + for (Long key : player.getExpeditionInfo().keySet()) { + ExpeditionInfo e = expeditionInfo.get(key); + proto.putExpeditionInfoMap(key, AvatarExpeditionInfo.newBuilder().setStateValue(e.getState()).setExpId(e.getExpId()).setHourTime(e.getHourTime()).setStartTime(e.getStartTime()).build()); + }; + + this.setData(proto.build()); + } +} \ No newline at end of file diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionDataNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionDataNotify.java new file mode 100644 index 000000000..1fe6bbee0 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionDataNotify.java @@ -0,0 +1,29 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.game.expedition.ExpeditionInfo; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.AvatarExpeditionDataNotifyOuterClass.AvatarExpeditionDataNotify; +import emu.grasscutter.net.proto.AvatarExpeditionInfoOuterClass.AvatarExpeditionInfo; + +import java.util.*; + +public class PacketAvatarExpeditionDataNotify extends BasePacket { + public PacketAvatarExpeditionDataNotify(Player player) { + super(PacketOpcodes.AvatarExpeditionDataNotify); + + Map<Long, AvatarExpeditionInfo> avatarExpeditionInfoList = new HashMap<Long, AvatarExpeditionInfo>(); + + var expeditionInfo = player.getExpeditionInfo(); + for (Long key : player.getExpeditionInfo().keySet()) { + ExpeditionInfo e = expeditionInfo.get(key); + avatarExpeditionInfoList.put(key, AvatarExpeditionInfo.newBuilder().setStateValue(e.getState()).setExpId(e.getExpId()).setHourTime(e.getHourTime()).setStartTime(e.getStartTime()).build()); + }; + + AvatarExpeditionDataNotify.Builder proto = AvatarExpeditionDataNotify.newBuilder() + .putAllExpeditionInfoMap(avatarExpeditionInfoList); + + this.setData(proto.build()); + } +} diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionGetRewardRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionGetRewardRsp.java new file mode 100644 index 000000000..34f0ea115 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionGetRewardRsp.java @@ -0,0 +1,30 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.game.expedition.ExpeditionInfo; +import emu.grasscutter.game.inventory.GameItem; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.AvatarExpeditionGetRewardRspOuterClass.AvatarExpeditionGetRewardRsp; +import emu.grasscutter.net.proto.AvatarExpeditionInfoOuterClass.AvatarExpeditionInfo; + +import java.util.Collection; + +public class PacketAvatarExpeditionGetRewardRsp extends BasePacket { + public PacketAvatarExpeditionGetRewardRsp(Player player, Collection<GameItem> items) { + super(PacketOpcodes.AvatarExpeditionGetRewardRsp); + + AvatarExpeditionGetRewardRsp.Builder proto = AvatarExpeditionGetRewardRsp.newBuilder(); + var expeditionInfo = player.getExpeditionInfo(); + for (Long key : player.getExpeditionInfo().keySet()) { + ExpeditionInfo e = expeditionInfo.get(key); + proto.putExpeditionInfoMap(key, AvatarExpeditionInfo.newBuilder().setStateValue(e.getState()).setExpId(e.getExpId()).setHourTime(e.getHourTime()).setStartTime(e.getStartTime()).build()); + }; + + for (GameItem item : items) { + proto.addItemList(item.toItemParam()); + } + + this.setData(proto.build()); + } +} diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionStartRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionStartRsp.java new file mode 100644 index 000000000..9a279124d --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarExpeditionStartRsp.java @@ -0,0 +1,23 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.game.expedition.ExpeditionInfo; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.AvatarExpeditionInfoOuterClass.AvatarExpeditionInfo; +import emu.grasscutter.net.proto.AvatarExpeditionStartRspOuterClass.AvatarExpeditionStartRsp; + +public class PacketAvatarExpeditionStartRsp extends BasePacket { + public PacketAvatarExpeditionStartRsp(Player player) { + super(PacketOpcodes.AvatarExpeditionStartRsp); + + AvatarExpeditionStartRsp.Builder proto = AvatarExpeditionStartRsp.newBuilder(); + var expeditionInfo = player.getExpeditionInfo(); + for (Long key : player.getExpeditionInfo().keySet()) { + ExpeditionInfo e = expeditionInfo.get(key); + proto.putExpeditionInfoMap(key, AvatarExpeditionInfo.newBuilder().setStateValue(e.getState()).setExpId(e.getExpId()).setHourTime(e.getHourTime()).setStartTime(e.getStartTime()).build()); + }; + + this.setData(proto.build()); + } +} From 0152b146c559d7336a044b60bb859b0fa9415898 Mon Sep 17 00:00:00 2001 From: cfuncode <36926346+cfuncode@users.noreply.github.com> Date: Sat, 7 May 2022 04:39:37 +0800 Subject: [PATCH 11/39] Improved fault tolerance for json file deserialization (#595) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修复一个Gson发序列化json文件的空值问题 * Improved fault tolerance for json file deserialization --- .../emu/grasscutter/data/ResourceLoader.java | 16 +++--- .../java/emu/grasscutter/utils/Utils.java | 55 ++++++++++++++++--- 2 files changed, 56 insertions(+), 15 deletions(-) diff --git a/src/main/java/emu/grasscutter/data/ResourceLoader.java b/src/main/java/emu/grasscutter/data/ResourceLoader.java index 5478052d8..b1e3da9ff 100644 --- a/src/main/java/emu/grasscutter/data/ResourceLoader.java +++ b/src/main/java/emu/grasscutter/data/ResourceLoader.java @@ -7,6 +7,7 @@ import java.util.Map.Entry; import java.util.regex.Matcher; import java.util.regex.Pattern; +import com.google.gson.Gson; import emu.grasscutter.utils.Utils; import org.reflections.Reflections; @@ -120,14 +121,15 @@ public class ResourceLoader { @SuppressWarnings({"rawtypes", "unchecked"}) protected static void loadFromResource(Class<?> c, String fileName, Int2ObjectMap map) throws Exception { - try (FileReader fileReader = new FileReader(Grasscutter.getConfig().RESOURCE_FOLDER + "ExcelBinOutput/" + fileName)) { - List list = Grasscutter.getGsonFactory().fromJson(fileReader, TypeToken.getParameterized(Collection.class, c).getType()); + FileReader fileReader = new FileReader(Grasscutter.getConfig().RESOURCE_FOLDER + "ExcelBinOutput/" + fileName); + Gson gson = Grasscutter.getGsonFactory(); + List list = gson.fromJson(fileReader, List.class); - for (Object o : list) { - GameResource res = (GameResource) o; - res.onLoad(); - map.put(res.getId(), res); - } + for (Object o : list) { + Map<String, Object> tempMap = Utils.switchPropertiesUpperLowerCase((Map<String, Object>) o, c); + GameResource res = gson.fromJson(gson.toJson(tempMap), TypeToken.get(c).getType()); + res.onLoad(); + map.put(res.getId(), res); } } diff --git a/src/main/java/emu/grasscutter/utils/Utils.java b/src/main/java/emu/grasscutter/utils/Utils.java index 1b4a00b90..931a37617 100644 --- a/src/main/java/emu/grasscutter/utils/Utils.java +++ b/src/main/java/emu/grasscutter/utils/Utils.java @@ -1,20 +1,24 @@ package emu.grasscutter.utils; -import java.io.*; -import java.nio.file.Files; -import java.nio.file.StandardCopyOption; -import java.time.*; -import java.time.temporal.TemporalAdjusters; -import java.util.Random; - import emu.grasscutter.Config; import emu.grasscutter.Grasscutter; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufUtil; import io.netty.buffer.Unpooled; - import org.slf4j.Logger; +import java.io.*; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import java.time.DayOfWeek; +import java.time.ZoneId; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.time.temporal.TemporalAdjusters; +import java.util.HashMap; +import java.util.Map; +import java.util.Random; + @SuppressWarnings({"UnusedReturnValue", "BooleanMethodIsAlwaysInverted"}) public final class Utils { public static final Random random = new Random(); @@ -230,4 +234,39 @@ public final class Utils { } return (int)zonedDateTime.toInstant().atZone(ZoneOffset.UTC).toEpochSecond(); } + + public static Map<String, Object> switchPropertiesUpperLowerCase(Map<String, Object> objMap, Class<?> cls) { + Map<String, Object> map = new HashMap<>(objMap.size()); + for (String key : objMap.keySet()) { + try { + char c = key.charAt(0); + if (c >= 'a' && c <= 'z') { + try { + cls.getDeclaredField(key); + map.put(key, objMap.get(key)); + } catch (NoSuchFieldException e) { + String s1 = String.valueOf(c).toUpperCase(); + String after = key.length() > 1 ? s1 + key.substring(1) : s1; + cls.getDeclaredField(after); + map.put(after, objMap.get(key)); + } + } else if (c >= 'A' && c <= 'Z') { + try { + cls.getDeclaredField(key); + map.put(key, objMap.get(key)); + } catch (NoSuchFieldException e) { + String s1 = String.valueOf(c).toLowerCase(); + String after = key.length() > 1 ? s1 + key.substring(1) : s1; + cls.getDeclaredField(after); + map.put(after, objMap.get(key)); + } + } + } catch (NoSuchFieldException e) { + map.put(key, objMap.get(key)); + } + } + + return map; + } + } From afa3747fad91c277339a0224f81fb1daa31b94d3 Mon Sep 17 00:00:00 2001 From: Scald <104459145+Arikatsu@users.noreply.github.com> Date: Sat, 7 May 2022 02:11:29 +0530 Subject: [PATCH 12/39] Add config option to change console server's signature, namecard, level and world level (#586) * Add files via upload * Add files via upload * Update GameConstants.java * Update Config.java * Update PacketGetPlayerFriendListRsp.java --- src/main/java/emu/grasscutter/Config.java | 4 ++++ src/main/java/emu/grasscutter/GameConstants.java | 4 ++++ .../server/packet/send/PacketGetPlayerFriendListRsp.java | 8 ++++---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/emu/grasscutter/Config.java b/src/main/java/emu/grasscutter/Config.java index c911a1cf0..f31d3b7cc 100644 --- a/src/main/java/emu/grasscutter/Config.java +++ b/src/main/java/emu/grasscutter/Config.java @@ -82,6 +82,10 @@ public final class Config { public boolean WatchGacha = false; public String ServerNickname = "Server"; public int ServerAvatarId = 10000007; + public int ServerNameCardId = 210001; + public int ServerLevel = 1; + public int ServerWorldLevel = 1; + public String ServerSignature = "Server Signature"; public int[] WelcomeEmotes = {2007, 1002, 4010}; public String WelcomeMotd = "Welcome to Grasscutter emu"; public String WelcomeMailTitle = "Welcome to Grasscutter!"; diff --git a/src/main/java/emu/grasscutter/GameConstants.java b/src/main/java/emu/grasscutter/GameConstants.java index 39b28b736..4bebf9c81 100644 --- a/src/main/java/emu/grasscutter/GameConstants.java +++ b/src/main/java/emu/grasscutter/GameConstants.java @@ -13,7 +13,11 @@ public final class GameConstants { public static final int MAIN_CHARACTER_FEMALE = 10000007; public static final String SERVER_AVATAR_NAME = Grasscutter.getConfig().getGameServerOptions().ServerNickname; public static final int SERVER_AVATAR_ID = Grasscutter.getConfig().getGameServerOptions().ServerAvatarId; + public static final String SERVER_SIGNATURE = Grasscutter.getConfig().getGameServerOptions().ServerSignature; public static final Position START_POSITION = new Position(2747, 194, -1719); + public static final int SERVER_NAMECARD_ID = Grasscutter.getConfig().getGameServerOptions().ServerNameCardId; + public static final int SERVER_LEVEL = Grasscutter.getConfig().getGameServerOptions().ServerLevel; + public static final int SERVER_WORLD_LEVEL = Grasscutter.getConfig().getGameServerOptions().ServerWorldLevel; public static final int MAX_FRIENDS = 45; public static final int MAX_FRIEND_REQUESTS = 50; diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java index d7a9427b8..781faf411 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java @@ -19,12 +19,12 @@ public class PacketGetPlayerFriendListRsp extends BasePacket { FriendBrief serverFriend = FriendBrief.newBuilder() .setUid(GameConstants.SERVER_CONSOLE_UID) .setNickname(GameConstants.SERVER_AVATAR_NAME) - .setLevel(1) + .setLevel(GameConstants.SERVER_LEVEL) .setProfilePicture(ProfilePicture.newBuilder().setAvatarId(GameConstants.SERVER_AVATAR_ID)) - .setWorldLevel(0) - .setSignature("") + .setWorldLevel(GameConstants.SERVER_WORLD_LEVEL) + .setSignature(GameConstants.SERVER_SIGNATURE) .setLastActiveTime((int) (System.currentTimeMillis() / 1000f)) - .setNameCardId(210001) + .setNameCardId(GameConstants.SERVER_NAMECARD_ID) .setOnlineState(FriendOnlineState.FRIEND_ONLINE) .setParam(1) .setIsGameSource(true) From 542a3cfc9b70fd09785f1ef2edb0556a1431e0fe Mon Sep 17 00:00:00 2001 From: wulf <lilch1022@hotmail.com> Date: Fri, 6 May 2022 23:21:23 +0800 Subject: [PATCH 13/39] fix scence block loading bug --- src/main/java/emu/grasscutter/scripts/SceneScriptManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java b/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java index 1784c827b..5f6a1b7e6 100644 --- a/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java +++ b/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java @@ -166,7 +166,7 @@ public class SceneScriptManager { List<SceneBlock> blocks = ScriptLoader.getSerializer().toList(SceneBlock.class, bindings.get("block_rects")); for (int i = 0; i < blocks.size(); i++) { - SceneBlock block = blocks.get(0); + SceneBlock block = blocks.get(i); block.id = blockIds.get(i); loadBlockFromScript(block); From 3f91fdcb71173320ff0930ca856bbb6278561f47 Mon Sep 17 00:00:00 2001 From: gentlespoon <github@gentlespoon.com> Date: Fri, 6 May 2022 14:38:14 -0700 Subject: [PATCH 14/39] Allow walking away from the statue within 2.5s to stop auto heal. --- .../managers/SotSManager/SotSManager.java | 82 +++++++++++++------ .../HandlerExitTransPointRegionNotify.java | 18 ++++ 2 files changed, 73 insertions(+), 27 deletions(-) create mode 100644 src/main/java/emu/grasscutter/server/packet/recv/HandlerExitTransPointRegionNotify.java diff --git a/src/main/java/emu/grasscutter/game/managers/SotSManager/SotSManager.java b/src/main/java/emu/grasscutter/game/managers/SotSManager/SotSManager.java index 4edad231e..0bfdf9454 100644 --- a/src/main/java/emu/grasscutter/game/managers/SotSManager/SotSManager.java +++ b/src/main/java/emu/grasscutter/game/managers/SotSManager/SotSManager.java @@ -2,9 +2,13 @@ package emu.grasscutter.game.managers.SotSManager; import emu.grasscutter.Grasscutter; import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.game.entity.EntityAvatar; +import emu.grasscutter.game.entity.GameEntity; +import emu.grasscutter.game.managers.MovementManager.MovementManager; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.PlayerProperty; +import emu.grasscutter.game.world.World; import emu.grasscutter.net.proto.ChangeHpReasonOuterClass; import emu.grasscutter.net.proto.PropChangeReasonOuterClass; import emu.grasscutter.server.game.GameSession; @@ -14,6 +18,8 @@ import emu.grasscutter.server.packet.send.PacketEntityFightPropChangeReasonNotif import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify; import java.util.List; +import java.util.Timer; +import java.util.TimerTask; // Statue of the Seven Manager public class SotSManager { @@ -21,6 +27,7 @@ public class SotSManager { // NOTE: Spring volume balance *1 = fight prop HP *100 private final Player player; + private Timer autoRecoverTimer; public SotSManager(Player player) { this.player = player; @@ -46,26 +53,44 @@ public class SotSManager { public void autoRevive(GameSession session) { player.getTeamManager().getActiveTeam().forEach(entity -> { boolean isAlive = entity.isAlive(); + float currentHP = entity.getAvatar().getFightProperty(FightProperty.FIGHT_PROP_CUR_HP); + float maxHP = entity.getAvatar().getFightProperty(FightProperty.FIGHT_PROP_MAX_HP); +// Grasscutter.getLogger().debug("" + entity.getAvatar().getAvatarData().getName() + "\t" + currentHP + "/" + maxHP + "\t" + (isAlive ? "ALIVE":"DEAD")); + float newHP = (float)(maxHP * 0.3); + if (currentHP < newHP) { + updateAvatarCurHP(session, entity, newHP); + } if (!isAlive) { - float maxHP = entity.getAvatar().getFightProperty(FightProperty.FIGHT_PROP_MAX_HP); - float newHP = (float)(maxHP * 0.3); - entity.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, newHP); entity.getWorld().broadcastPacket(new PacketAvatarLifeStateChangeNotify(entity.getAvatar())); } }); } public void scheduleAutoRecover(GameSession session) { - // TODO: play audio effects? possibly client side? - client automatically plays. - // delay 2.5 seconds - new Thread(() -> { - try { - Thread.sleep(2500); - autoRecover(session); - } catch (Exception e) { - Grasscutter.getLogger().error(e.getMessage()); - } - }).start(); + if (autoRecoverTimer == null) { + autoRecoverTimer = new Timer(); + autoRecoverTimer.schedule(new AutoRecoverTimerTick(session), 2500); + } + } + + public void cancelAutoRecover() { + if (autoRecoverTimer != null) { + autoRecoverTimer.cancel(); + autoRecoverTimer = null; + } + } + + private class AutoRecoverTimerTick extends TimerTask + { + private GameSession session; + + public AutoRecoverTimerTick(GameSession session) { + this.session = session; + } + public void run() { + autoRecover(session); + cancelAutoRecover(); + } } public void refillSpringVolume() { @@ -124,24 +149,27 @@ public class SotSManager { float newHP = currentHP + needSV / 100; // convert SV to HP - // TODO: Figure out why client shows current HP instead of added HP. - // Say an avatar had 12000 and now has 14000, it should show "2000". - // The client always show "+14000" which is incorrect. - - entity.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, newHP); - session.send(new PacketEntityFightPropChangeReasonNotify(entity, FightProperty.FIGHT_PROP_CUR_HP, - newHP, List.of(3), PropChangeReasonOuterClass.PropChangeReason.PROP_CHANGE_STATUE_RECOVER, - ChangeHpReasonOuterClass.ChangeHpReason.ChangeHpAddStatue)); - session.send(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CUR_HP)); - - Avatar avatar = entity.getAvatar(); - avatar.setCurrentHp(newHP); - session.send(new PacketAvatarFightPropUpdateNotify(avatar, FightProperty.FIGHT_PROP_CUR_HP)); - player.save(); + updateAvatarCurHP(session, entity, newHP); } }); } } + private void updateAvatarCurHP(GameSession session, EntityAvatar entity, float newHP) { + // TODO: Figure out why client shows current HP instead of added HP. + // Say an avatar had 12000 and now has 14000, it should show "2000". + // The client always show "+14000" which is incorrect. + entity.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, newHP); + session.send(new PacketEntityFightPropChangeReasonNotify(entity, FightProperty.FIGHT_PROP_CUR_HP, + newHP, List.of(3), PropChangeReasonOuterClass.PropChangeReason.PROP_CHANGE_STATUE_RECOVER, + ChangeHpReasonOuterClass.ChangeHpReason.ChangeHpAddStatue)); + session.send(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CUR_HP)); + + Avatar avatar = entity.getAvatar(); + avatar.setCurrentHp(newHP); + session.send(new PacketAvatarFightPropUpdateNotify(avatar, FightProperty.FIGHT_PROP_CUR_HP)); + player.save(); + } + } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerExitTransPointRegionNotify.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerExitTransPointRegionNotify.java new file mode 100644 index 000000000..35ec957cb --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerExitTransPointRegionNotify.java @@ -0,0 +1,18 @@ +package emu.grasscutter.server.packet.recv; + +import emu.grasscutter.game.managers.SotSManager.SotSManager; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.Opcodes; +import emu.grasscutter.net.packet.PacketHandler; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.server.game.GameSession; + +@Opcodes(PacketOpcodes.ExitTransPointRegionNotify) +public class HandlerExitTransPointRegionNotify extends PacketHandler { + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception{ + Player player = session.getPlayer(); + SotSManager sotsManager = player.getSotSManager(); + sotsManager.cancelAutoRecover(); + } +} From 58cb60299caa414e7e8c605f44e12261ac5e508f Mon Sep 17 00:00:00 2001 From: gentlespoon <github@gentlespoon.com> Date: Fri, 6 May 2022 15:10:20 -0700 Subject: [PATCH 15/39] Fix #593: Accidental death of character --- .../managers/MovementManager/MovementManager.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/emu/grasscutter/game/managers/MovementManager/MovementManager.java b/src/main/java/emu/grasscutter/game/managers/MovementManager/MovementManager.java index a08280378..ed1645936 100644 --- a/src/main/java/emu/grasscutter/game/managers/MovementManager/MovementManager.java +++ b/src/main/java/emu/grasscutter/game/managers/MovementManager/MovementManager.java @@ -60,6 +60,7 @@ public class MovementManager { private final Player player; private float landSpeed = 0; + private long landTimeMillisecond = 0; private Timer movementManagerTickTimer; private GameSession cachedSession = null; private GameEntity cachedEntity = null; @@ -192,12 +193,20 @@ public class MovementManager { // cache land speed if (state == MotionState.MOTION_LAND_SPEED) { landSpeed = motionInfo.getSpeed().getY(); + landTimeMillisecond = System.currentTimeMillis(); } if (state == MotionState.MOTION_FALL_ON_GROUND) { + // if not received immediately after MOTION_LAND_SPEED, discard this packet. + // TODO: Test in high latency. + int maxDelay = 200; + if ((System.currentTimeMillis() - landTimeMillisecond) > maxDelay) { + Grasscutter.getLogger().debug("MOTION_FALL_ON_GROUND received after " + maxDelay + "ms, discard."); + return; + } float currentHP = cachedEntity.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP); float maxHP = cachedEntity.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP); float damage = 0; -// Grasscutter.getLogger().debug("LandSpeed: " + landSpeed); + Grasscutter.getLogger().debug("LandSpeed: " + landSpeed); if (landSpeed < -23.5) { damage = (float)(maxHP * 0.33); } @@ -214,7 +223,7 @@ public class MovementManager { if (newHP < 0) { newHP = 0; } -// Grasscutter.getLogger().debug("Max: " + maxHP + "\tCurr: " + currentHP + "\tDamage: " + damage + "\tnewHP: " + newHP); + Grasscutter.getLogger().debug("Max: " + maxHP + "\tCurr: " + currentHP + "\tDamage: " + damage + "\tnewHP: " + newHP); cachedEntity.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, newHP); cachedEntity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(cachedEntity, FightProperty.FIGHT_PROP_CUR_HP)); if (newHP == 0) { From b3a917007b1d56498e30dc5f3ae43b46214fd7f7 Mon Sep 17 00:00:00 2001 From: KingRainbow44 <kobedo11@gmail.com> Date: Fri, 6 May 2022 18:50:18 -0400 Subject: [PATCH 16/39] Convert to the superior language system. (pt. 3) --- .../command/commands/CoopCommand.java | 15 ++++++------- .../command/commands/GiveAllCommand.java | 10 +++++---- .../command/commands/GiveArtifactCommand.java | 16 +++++++------- .../commands/KillCharacterCommand.java | 5 +++-- .../command/commands/ListCommand.java | 4 +++- .../command/commands/PermissionCommand.java | 14 ++++++------- .../commands/ResetShopLimitCommand.java | 4 +++- .../command/commands/SendMessageCommand.java | 5 ++--- .../commands/SetFetterLevelCommand.java | 11 +++++----- .../command/commands/SetStatsCommand.java | 1 - .../commands/SetWorldLevelCommand.java | 10 +++++---- .../command/commands/SpawnCommand.java | 14 +++++++------ .../command/commands/StopCommand.java | 8 ++++--- .../command/commands/TeleportAllCommand.java | 6 +++++- .../command/commands/TeleportCommand.java | 15 ++++++++----- .../command/commands/WeatherCommand.java | 11 +++++----- .../DefaultAuthenticationHandler.java | 21 +++++++++---------- 17 files changed, 97 insertions(+), 73 deletions(-) diff --git a/src/main/java/emu/grasscutter/command/commands/CoopCommand.java b/src/main/java/emu/grasscutter/command/commands/CoopCommand.java index d41805c82..96411019b 100644 --- a/src/main/java/emu/grasscutter/command/commands/CoopCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/CoopCommand.java @@ -7,6 +7,8 @@ import emu.grasscutter.game.player.Player; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "coop", usage = "coop [host UID]", description = "Forces someone to join the world of others", permission = "server.coop") public final class CoopCommand implements CommandHandler { @@ -20,26 +22,25 @@ public final class CoopCommand implements CommandHandler { Player host = sender; switch (args.size()) { case 0: // Summon target to self - if (sender == null) { // Console doesn't have a self to summon to - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Coop_usage); + CommandHandler.sendMessage(sender, translate("commands.coop.usage")); + if (sender == null) // Console doesn't have a self to summon to return; - } break; case 1: // Summon target to argument try { int hostId = Integer.parseInt(args.get(0)); host = Grasscutter.getGameServer().getPlayerByUid(hostId); if (host == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Player_is_offline); + CommandHandler.sendMessage(sender, translate("commands.execution.player_offline_error")); return; } break; } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_playerId); + CommandHandler.sendMessage(sender, translate("commands.execution.uid_error")); return; } default: - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Coop_usage); + CommandHandler.sendMessage(sender, translate("commands.coop.usage")); return; } @@ -49,6 +50,6 @@ public final class CoopCommand implements CommandHandler { } host.getServer().getMultiplayerManager().applyEnterMp(targetPlayer, host.getUid()); targetPlayer.getServer().getMultiplayerManager().applyEnterMpReply(host, targetPlayer.getUid(), true); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Coop_success.replace("{host}", host.getNickname()).replace("{target}", targetPlayer.getNickname())); + CommandHandler.sendMessage(sender, translate("commands.coop.success", targetPlayer.getNickname(), host.getNickname())); } } diff --git a/src/main/java/emu/grasscutter/command/commands/GiveAllCommand.java b/src/main/java/emu/grasscutter/command/commands/GiveAllCommand.java index ea249af9e..bb11de3c2 100644 --- a/src/main/java/emu/grasscutter/command/commands/GiveAllCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/GiveAllCommand.java @@ -13,6 +13,8 @@ import emu.grasscutter.game.player.Player; import java.util.*; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "giveall", usage = "giveall [amount]", description = "Gives all items", aliases = {"givea"}, permission = "player.giveall", threading = true) public final class GiveAllCommand implements CommandHandler { @@ -32,21 +34,21 @@ public final class GiveAllCommand implements CommandHandler { try { amount = Integer.parseInt(args.get(0)); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_amount); + CommandHandler.sendMessage(sender, translate("commands.generic.invalid.amount")); return; } break; default: // invalid - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().GiveAll_usage); + CommandHandler.sendMessage(sender, translate("commands.giveAll.usage")); return; } this.giveAllItems(targetPlayer, amount); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().GiveAll_done); + CommandHandler.sendMessage(sender, translate("commands.giveAll.success", targetPlayer.getNickname())); } public void giveAllItems(Player player, int amount) { - CommandHandler.sendMessage(player, Grasscutter.getLanguage().GiveAll_item); + CommandHandler.sendMessage(player, translate("commands.giveAll.started")); for (AvatarData avatarData: GameData.getAvatarDataMap().values()) { //Exclude test avatar diff --git a/src/main/java/emu/grasscutter/command/commands/GiveArtifactCommand.java b/src/main/java/emu/grasscutter/command/commands/GiveArtifactCommand.java index 5b8351a5a..541cc440e 100644 --- a/src/main/java/emu/grasscutter/command/commands/GiveArtifactCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/GiveArtifactCommand.java @@ -14,6 +14,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "giveart", usage = "giveart <artifactId> <mainPropId> [<appendPropId>[,<times>]]... [level]", description = "Gives the player a specified artifact", aliases = {"gart"}, permission = "player.giveart") public final class GiveArtifactCommand implements CommandHandler { @Override @@ -24,7 +26,7 @@ public final class GiveArtifactCommand implements CommandHandler { } if (args.size() < 2) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().GiveArtifact_usage); + CommandHandler.sendMessage(sender, translate("commands.giveArtifact.usage")); return; } @@ -32,12 +34,12 @@ public final class GiveArtifactCommand implements CommandHandler { try { itemId = Integer.parseInt(args.remove(0)); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_artifact_id); + CommandHandler.sendMessage(sender, translate("commands.giveArtifact.id_error")); return; } ItemData itemData = GameData.getItemDataMap().get(itemId); if (itemData.getItemType() != ItemType.ITEM_RELIQUARY) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_artifact_id); + CommandHandler.sendMessage(sender, translate("commands.giveArtifact.id_error")); return; } @@ -45,7 +47,7 @@ public final class GiveArtifactCommand implements CommandHandler { try { mainPropId = Integer.parseInt(args.remove(0)); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_arguments); + CommandHandler.sendMessage(sender, translate("commands.generic.execution.argument_error")); return; } @@ -59,7 +61,7 @@ public final class GiveArtifactCommand implements CommandHandler { } catch (NumberFormatException ignored) { // Could be a stat,times string so no need to panic } - ArrayList<Integer> appendPropIdList = new ArrayList<>(); + List<Integer> appendPropIdList = new ArrayList<>(); try { args.forEach(it -> { String[] arr; @@ -74,7 +76,7 @@ public final class GiveArtifactCommand implements CommandHandler { appendPropIdList.addAll(Collections.nCopies(n, Integer.parseInt(it))); }); } catch (Exception ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_arguments); + CommandHandler.sendMessage(sender, translate("commands.execution.argument_error")); return; } @@ -85,7 +87,7 @@ public final class GiveArtifactCommand implements CommandHandler { item.getAppendPropIdList().addAll(appendPropIdList); targetPlayer.getInventory().addItem(item, ActionReason.SubfieldDrop); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().GiveArtifact_given.replace("{itemId}", Integer.toString(itemId)).replace("target", Integer.toString(targetPlayer.getUid()))); + CommandHandler.sendMessage(sender, translate("commands.giveArtifact.success", Integer.toString(itemId), Integer.toString(targetPlayer.getUid()))); } } diff --git a/src/main/java/emu/grasscutter/command/commands/KillCharacterCommand.java b/src/main/java/emu/grasscutter/command/commands/KillCharacterCommand.java index 82a18f72d..f1e0f0f8c 100644 --- a/src/main/java/emu/grasscutter/command/commands/KillCharacterCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/KillCharacterCommand.java @@ -1,6 +1,5 @@ package emu.grasscutter.command.commands; -import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; import emu.grasscutter.game.entity.EntityAvatar; @@ -12,6 +11,8 @@ import emu.grasscutter.server.packet.send.PacketLifeStateChangeNotify; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "killcharacter", usage = "killcharacter", aliases = {"suicide", "kill"}, description = "Kills the players current character", permission = "player.killcharacter") public final class KillCharacterCommand implements CommandHandler { @@ -32,6 +33,6 @@ public final class KillCharacterCommand implements CommandHandler { targetPlayer.getScene().removeEntity(entity); entity.onDeath(0); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().KillCharacter_kill_current_character.replace("{name}", targetPlayer.getNickname())); + CommandHandler.sendMessage(sender, translate("commands.killCharacter.success", targetPlayer.getNickname())); } } diff --git a/src/main/java/emu/grasscutter/command/commands/ListCommand.java b/src/main/java/emu/grasscutter/command/commands/ListCommand.java index 3119f728f..bc35e65e1 100644 --- a/src/main/java/emu/grasscutter/command/commands/ListCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/ListCommand.java @@ -8,6 +8,8 @@ import emu.grasscutter.game.player.Player; import java.util.List; import java.util.Map; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "list", usage = "list [uid]", description = "List online players", aliases = {"players"}) public final class ListCommand implements CommandHandler { @@ -21,7 +23,7 @@ public final class ListCommand implements CommandHandler { needUID = args.get(0).equals("uid"); } - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().List_message.replace("{size}", Integer.toString(playersMap.size()))); + CommandHandler.sendMessage(sender, translate("commands.list.success", Integer.toString(playersMap.size()))); if (playersMap.size() != 0) { StringBuilder playerSet = new StringBuilder(); diff --git a/src/main/java/emu/grasscutter/command/commands/PermissionCommand.java b/src/main/java/emu/grasscutter/command/commands/PermissionCommand.java index aa99939f6..69c8ce899 100644 --- a/src/main/java/emu/grasscutter/command/commands/PermissionCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/PermissionCommand.java @@ -22,7 +22,7 @@ public final class PermissionCommand implements CommandHandler { } if (args.size() != 2) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Permission_usage); + CommandHandler.sendMessage(sender, translate("commands.permission.usage")); return; } @@ -31,23 +31,23 @@ public final class PermissionCommand implements CommandHandler { Account account = targetPlayer.getAccount(); if (account == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Account_not_find); + CommandHandler.sendMessage(sender, translate("commands.permission.account_error")); return; } switch (action) { default: - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Permission_usage); + CommandHandler.sendMessage(sender, translate("commands.permission.usage")); break; case "add": if (account.addPermission(permission)) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Permission_add); - } else CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Permission_have_permission); + CommandHandler.sendMessage(sender, translate("commands.permission.add")); + } else CommandHandler.sendMessage(sender, translate("commands.permission.has_error")); break; case "remove": if (account.removePermission(permission)) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Permission_remove); - } else CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Permission_not_have_permission); + CommandHandler.sendMessage(sender, translate("commands.permission.remove")); + } else CommandHandler.sendMessage(sender, translate("commands.permission.not_have_error")); break; } diff --git a/src/main/java/emu/grasscutter/command/commands/ResetShopLimitCommand.java b/src/main/java/emu/grasscutter/command/commands/ResetShopLimitCommand.java index 59d8b32e8..aeae0abbf 100644 --- a/src/main/java/emu/grasscutter/command/commands/ResetShopLimitCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/ResetShopLimitCommand.java @@ -7,6 +7,8 @@ import emu.grasscutter.game.player.Player; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "resetshop", usage = "resetshop", description = "Reset target player's shop refresh time.", permission = "server.resetshop") public final class ResetShopLimitCommand implements CommandHandler { @@ -19,6 +21,6 @@ public final class ResetShopLimitCommand implements CommandHandler { targetPlayer.getShopLimit().forEach(x -> x.setNextRefreshTime(0)); targetPlayer.save(); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Success); + CommandHandler.sendMessage(sender, translate("commands.status.success")); } } diff --git a/src/main/java/emu/grasscutter/command/commands/SendMessageCommand.java b/src/main/java/emu/grasscutter/command/commands/SendMessageCommand.java index 41f76ba80..acf63dea0 100644 --- a/src/main/java/emu/grasscutter/command/commands/SendMessageCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SendMessageCommand.java @@ -1,6 +1,5 @@ package emu.grasscutter.command.commands; -import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; import emu.grasscutter.game.player.Player; @@ -20,12 +19,12 @@ public final class SendMessageCommand implements CommandHandler { return; } if (args.size() == 0) { - CommandHandler.sendMessage(null, Grasscutter.getLanguage().SendMessage_usage); + CommandHandler.sendMessage(null, translate("commands.sendMessage.usage")); return; } String message = String.join(" ", args); CommandHandler.sendMessage(targetPlayer, message); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SenaMessage_message_sent); + CommandHandler.sendMessage(sender, translate("commands.sendMessage.success")); } } \ No newline at end of file diff --git a/src/main/java/emu/grasscutter/command/commands/SetFetterLevelCommand.java b/src/main/java/emu/grasscutter/command/commands/SetFetterLevelCommand.java index 21507b998..7184c679c 100644 --- a/src/main/java/emu/grasscutter/command/commands/SetFetterLevelCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SetFetterLevelCommand.java @@ -2,7 +2,6 @@ package emu.grasscutter.command.commands; import java.util.List; -import emu.grasscutter.Grasscutter; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; import emu.grasscutter.data.GameData; @@ -10,6 +9,8 @@ import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.player.Player; import emu.grasscutter.server.packet.send.PacketAvatarFetterDataNotify; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "setfetterlevel", usage = "setfetterlevel <level>", description = "Sets your fetter level for your current active character", aliases = {"setfetterlvl", "setfriendship"}, permission = "player.setfetterlevel") @@ -23,14 +24,14 @@ public final class SetFetterLevelCommand implements CommandHandler { } if (args.size() != 1) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SetFetterLevel_usage); + CommandHandler.sendMessage(sender, translate("commands.setFetterLevel.usage")); return; } try { int fetterLevel = Integer.parseInt(args.get(0)); if (fetterLevel < 0 || fetterLevel > 10) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SetFetterLevel_fetter_level_must_between_0_and_10); + CommandHandler.sendMessage(sender, translate("commands.setFetterLevel.range_error")); return; } Avatar avatar = targetPlayer.getTeamManager().getCurrentAvatarEntity().getAvatar(); @@ -42,9 +43,9 @@ public final class SetFetterLevelCommand implements CommandHandler { avatar.save(); targetPlayer.sendPacket(new PacketAvatarFetterDataNotify(avatar)); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SetFetterLevel_fetter_set_level.replace("{level}", Integer.toString(fetterLevel))); + CommandHandler.sendMessage(sender, translate("commands.setFetterLevel.success", fetterLevel)); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SetFetterLevel_invalid_fetter_level); + CommandHandler.sendMessage(sender, translate("commands.setFetterLevel.level_error")); } } diff --git a/src/main/java/emu/grasscutter/command/commands/SetStatsCommand.java b/src/main/java/emu/grasscutter/command/commands/SetStatsCommand.java index 3498e267b..233eb4d73 100644 --- a/src/main/java/emu/grasscutter/command/commands/SetStatsCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SetStatsCommand.java @@ -33,7 +33,6 @@ public final class SetStatsCommand implements CommandHandler { Map<String, Stat> stats = new HashMap<>(); public SetStatsCommand() { - Language lang = Grasscutter.getLanguage(); // Default stats stats.put("maxhp", new Stat(FightProperty.FIGHT_PROP_MAX_HP.toString(), FightProperty.FIGHT_PROP_MAX_HP, false)); stats.put("hp", new Stat(FightProperty.FIGHT_PROP_CUR_HP.toString(), FightProperty.FIGHT_PROP_CUR_HP, false)); diff --git a/src/main/java/emu/grasscutter/command/commands/SetWorldLevelCommand.java b/src/main/java/emu/grasscutter/command/commands/SetWorldLevelCommand.java index 39f4753a7..914d8cecc 100644 --- a/src/main/java/emu/grasscutter/command/commands/SetWorldLevelCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SetWorldLevelCommand.java @@ -7,6 +7,8 @@ import emu.grasscutter.game.player.Player; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "setworldlevel", usage = "setworldlevel <level>", description = "Sets your world level (Relog to see proper effects)", aliases = {"setworldlvl"}, permission = "player.setworldlevel") @@ -20,14 +22,14 @@ public final class SetWorldLevelCommand implements CommandHandler { } if (args.size() < 1) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SetWorldLevel_usage); + CommandHandler.sendMessage(sender, translate("commands.setWorldLevel.usage")); return; } try { int level = Integer.parseInt(args.get(0)); if (level > 8 || level < 0) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SetWorldLevel_world_level_must_between_0_and_8); + CommandHandler.sendMessage(sender, translate("commands.setWorldLevel.value_error")); return; } @@ -35,9 +37,9 @@ public final class SetWorldLevelCommand implements CommandHandler { targetPlayer.getWorld().setWorldLevel(level); targetPlayer.setWorldLevel(level); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().SetWorldLevel_set_world_level.replace("{level}", Integer.toString(level))); + CommandHandler.sendMessage(sender, translate("commands.setWorldLevel.success", Integer.toString(level))); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(null, Grasscutter.getLanguage().SetWorldLevel_invalid_world_level); + CommandHandler.sendMessage(null, translate("commands.setWorldLevel.invalid_world_level")); } } } diff --git a/src/main/java/emu/grasscutter/command/commands/SpawnCommand.java b/src/main/java/emu/grasscutter/command/commands/SpawnCommand.java index c50eb972d..c66a45b50 100644 --- a/src/main/java/emu/grasscutter/command/commands/SpawnCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SpawnCommand.java @@ -20,6 +20,8 @@ import javax.swing.text.html.parser.Entity; import java.util.List; import java.util.Random; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "spawn", usage = "spawn <entityId> [amount] [level(monster only)]", description = "Spawns an entity near you", permission = "server.spawn") public final class SpawnCommand implements CommandHandler { @@ -39,23 +41,23 @@ public final class SpawnCommand implements CommandHandler { try { level = Integer.parseInt(args.get(2)); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_arguments); + CommandHandler.sendMessage(sender, translate("commands.execution.argument_error")); } // Fallthrough case 2: try { amount = Integer.parseInt(args.get(1)); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_amount); + CommandHandler.sendMessage(sender, translate("commands.generic.error.amount")); } // Fallthrough case 1: try { id = Integer.parseInt(args.get(0)); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_entity_id); + CommandHandler.sendMessage(sender, translate("commands.generic.error.entityId")); } break; default: - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Spawn_usage); + CommandHandler.sendMessage(sender, translate("commands.spawn.usage")); return; } @@ -63,7 +65,7 @@ public final class SpawnCommand implements CommandHandler { GadgetData gadgetData = GameData.getGadgetDataMap().get(id); ItemData itemData = GameData.getItemDataMap().get(id); if (monsterData == null && gadgetData == null && itemData == null) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_entity_id); + CommandHandler.sendMessage(sender, translate("commands.generic.error.entityId")); return; } Scene scene = targetPlayer.getScene(); @@ -99,7 +101,7 @@ public final class SpawnCommand implements CommandHandler { scene.addEntity(entity); } - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Spawn_message.replace("{amount}", Integer.toString(amount)).replace("{id}", Integer.toString(id))); + CommandHandler.sendMessage(sender, translate("commands.spawn.success", Integer.toString(amount), Integer.toString(id))); } private Position GetRandomPositionInCircle(Position origin, double radius){ diff --git a/src/main/java/emu/grasscutter/command/commands/StopCommand.java b/src/main/java/emu/grasscutter/command/commands/StopCommand.java index 4d0f8c1c5..ad4903107 100644 --- a/src/main/java/emu/grasscutter/command/commands/StopCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/StopCommand.java @@ -7,17 +7,19 @@ import emu.grasscutter.game.player.Player; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "stop", usage = "stop", description = "Stops the server", permission = "server.stop") public final class StopCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List<String> args) { - CommandHandler.sendMessage(null, Grasscutter.getLanguage().Stop_message); + CommandHandler.sendMessage(null, translate("commands.stop.success")); for (Player p : Grasscutter.getGameServer().getPlayers().values()) { - CommandHandler.sendMessage(p, Grasscutter.getLanguage().Stop_message); + CommandHandler.sendMessage(p, translate("commands.stop.success")); } - System.exit(1); + System.exit(1000); } } diff --git a/src/main/java/emu/grasscutter/command/commands/TeleportAllCommand.java b/src/main/java/emu/grasscutter/command/commands/TeleportAllCommand.java index fe9b5dc49..54c6101f7 100644 --- a/src/main/java/emu/grasscutter/command/commands/TeleportAllCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/TeleportAllCommand.java @@ -8,6 +8,8 @@ import emu.grasscutter.utils.Position; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "tpall", usage = "tpall", description = "Teleports all players in your world to your position", permission = "player.tpall") public final class TeleportAllCommand implements CommandHandler { @@ -19,7 +21,7 @@ public final class TeleportAllCommand implements CommandHandler { } if (!targetPlayer.getWorld().isMultiplayer()) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().TeleportAll_message); + CommandHandler.sendMessage(sender, translate("commands.teleportAll.error")); return; } @@ -30,5 +32,7 @@ public final class TeleportAllCommand implements CommandHandler { player.getWorld().transferPlayerToScene(player, targetPlayer.getSceneId(), pos); } + + CommandHandler.sendMessage(sender, translate("commands.teleportAll.success")); } } diff --git a/src/main/java/emu/grasscutter/command/commands/TeleportCommand.java b/src/main/java/emu/grasscutter/command/commands/TeleportCommand.java index ef7e68ae9..06b669a17 100644 --- a/src/main/java/emu/grasscutter/command/commands/TeleportCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/TeleportCommand.java @@ -8,6 +8,8 @@ import emu.grasscutter.utils.Position; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "teleport", usage = "teleport <x> <y> <z> [scene id]", aliases = {"tp"}, description = "Change the player's position.", permission = "player.teleport") public final class TeleportCommand implements CommandHandler { @@ -41,7 +43,7 @@ public final class TeleportCommand implements CommandHandler { try { sceneId = Integer.parseInt(args.get(3)); }catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Invalid_arguments); + CommandHandler.sendMessage(sender, translate("commands.execution.argument_error")); } // Fallthrough case 3: try { @@ -49,20 +51,23 @@ public final class TeleportCommand implements CommandHandler { y = parseRelative(args.get(1), y); z = parseRelative(args.get(2), z); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Teleport_invalid_position); + CommandHandler.sendMessage(sender, translate("commands.teleport.invalid_position")); } break; default: - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Teleport_usage); + CommandHandler.sendMessage(sender, translate("commands.teleport.usage")); return; } Position target_pos = new Position(x, y, z); boolean result = targetPlayer.getWorld().transferPlayerToScene(targetPlayer, sceneId, target_pos); if (!result) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Teleport_invalid_position); + CommandHandler.sendMessage(sender, translate("commands.teleport.invalid_position")); } else { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Teleport_message.replace("{name}", targetPlayer.getNickname()).replace("{x}", Float.toString(x)).replace("{y}", Float.toString(y)).replace("{z}", Float.toString(z)).replace("{id}", Integer.toString(sceneId))); + CommandHandler.sendMessage(sender, translate("commands.teleport.success", + targetPlayer.getNickname(), Float.toString(x), Float.toString(y), + Float.toString(z), Integer.toString(sceneId)) + ); } } diff --git a/src/main/java/emu/grasscutter/command/commands/WeatherCommand.java b/src/main/java/emu/grasscutter/command/commands/WeatherCommand.java index 431e53853..df8a6a01f 100644 --- a/src/main/java/emu/grasscutter/command/commands/WeatherCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/WeatherCommand.java @@ -9,6 +9,8 @@ import emu.grasscutter.server.packet.send.PacketSceneAreaWeatherNotify; import java.util.List; +import static emu.grasscutter.utils.Language.translate; + @Command(label = "weather", usage = "weather <weatherId> [climateId]", description = "Changes the weather.", aliases = {"w"}, permission = "player.weather") public final class WeatherCommand implements CommandHandler { @@ -27,17 +29,17 @@ public final class WeatherCommand implements CommandHandler { try { climateId = Integer.parseInt(args.get(1)); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Weather_invalid_id); + CommandHandler.sendMessage(sender, translate("commands.weather.invalid_id")); } case 1: try { weatherId = Integer.parseInt(args.get(0)); } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Weather_invalid_id); + CommandHandler.sendMessage(sender, translate("commands.weather.invalid_id")); } break; default: - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Weather_usage); + CommandHandler.sendMessage(sender, translate("commands.weather.usage")); return; } @@ -46,7 +48,6 @@ public final class WeatherCommand implements CommandHandler { targetPlayer.getScene().setWeather(weatherId); targetPlayer.getScene().setClimate(climate); targetPlayer.getScene().broadcastPacket(new PacketSceneAreaWeatherNotify(targetPlayer)); - CommandHandler.sendMessage(sender, Grasscutter.getLanguage().Weather_message.replace("{weatherId}", Integer.toString(weatherId)).replace("{climateId}", Integer.toString(climateId))); - + CommandHandler.sendMessage(sender, translate("commands.weather.success", Integer.toString(weatherId), Integer.toString(climateId))); } } diff --git a/src/main/java/emu/grasscutter/server/dispatch/authentication/DefaultAuthenticationHandler.java b/src/main/java/emu/grasscutter/server/dispatch/authentication/DefaultAuthenticationHandler.java index 73c696502..e5a4ca055 100644 --- a/src/main/java/emu/grasscutter/server/dispatch/authentication/DefaultAuthenticationHandler.java +++ b/src/main/java/emu/grasscutter/server/dispatch/authentication/DefaultAuthenticationHandler.java @@ -8,6 +8,8 @@ import emu.grasscutter.server.dispatch.json.LoginResultJson; import express.http.Request; import express.http.Response; +import static emu.grasscutter.utils.Language.translate; + public class DefaultAuthenticationHandler implements AuthenticationHandler { @Override @@ -34,11 +36,9 @@ public class DefaultAuthenticationHandler implements AuthenticationHandler { // Check if account exists, else create a new one. if (account == null) { - // Account doesnt exist, so we can either auto create it if the config value is - // set + // Account doesn't exist, so we can either auto create it if the config value is set. if (Grasscutter.getConfig().getDispatchOptions().AutomaticallyCreateAccounts) { - // This account has been created AUTOMATICALLY. There will be no permissions - // added. + // This account has been created AUTOMATICALLY. There will be no permissions added. account = DatabaseHelper.createAccountWithId(requestData.account, 0); for (String permission : Grasscutter.getConfig().getDispatchOptions().defaultPermissions) { @@ -51,19 +51,18 @@ public class DefaultAuthenticationHandler implements AuthenticationHandler { responseData.data.account.token = account.generateSessionKey(); responseData.data.account.email = account.getEmail(); - Grasscutter.getLogger().info(Grasscutter.getLanguage().Client_failed_login_account_create.replace("{ip}", req.ip()).replace("{uid}", responseData.data.account.uid)); + Grasscutter.getLogger().info(translate("messages.dispatch.account.account_login_create_success", req.ip(), responseData.data.account.uid)); } else { responseData.retcode = -201; - responseData.message = Grasscutter.getLanguage().Username_not_found_create_failed; + responseData.message = translate("messages.dispatch.account.username_create_error"); - Grasscutter.getLogger().info(Grasscutter.getLanguage().Client_failed_login_account_no_found.replace("{ip}", req.ip())); + Grasscutter.getLogger().info(translate("messages.dispatch.account.account_login_create_error", req.ip())); } } else { responseData.retcode = -201; - responseData.message = Grasscutter.getLanguage().Username_not_found; + responseData.message = translate("messages.dispatch.account.username_error"); - Grasscutter.getLogger().info(String - .format(Grasscutter.getLanguage().Client_failed_login_account_no_found, req.ip())); + Grasscutter.getLogger().info(translate("messages.dispatch.account.account_login_exist_error", req.ip())); } } else { // Account was found, log the player in @@ -72,7 +71,7 @@ public class DefaultAuthenticationHandler implements AuthenticationHandler { responseData.data.account.token = account.generateSessionKey(); responseData.data.account.email = account.getEmail(); - Grasscutter.getLogger().info(Grasscutter.getLanguage().Client_login.replace("{ip}", req.ip()).replace("{uid}", responseData.data.account.uid)); + Grasscutter.getLogger().info(translate("messages.dispatch.account.login_success", req.ip(), responseData.data.account.uid)); } return responseData; From 647922ff01308e903b29079d71b42d6f4ab93d64 Mon Sep 17 00:00:00 2001 From: KingRainbow44 <kobedo11@gmail.com> Date: Fri, 6 May 2022 18:50:43 -0400 Subject: [PATCH 17/39] Add the `en-US` language. --- src/main/resources/languages/en_US.json | 43 +++++++++++++------------ 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/main/resources/languages/en_US.json b/src/main/resources/languages/en_US.json index f2f6b59ec..48ffb5b0b 100644 --- a/src/main/resources/languages/en_US.json +++ b/src/main/resources/languages/en_US.json @@ -118,7 +118,8 @@ "everything": "Cleared everything for %s." }, "coop": { - "usage": "Usage: coop <playerId> <target playerId>" + "usage": "Usage: coop <playerId> <target playerId>", + "success": "Summoned %s to %s's world." }, "enter_dungeon": { "usage": "Usage: enterdungeon <dungeon id>", @@ -128,14 +129,14 @@ }, "giveAll": { "usage": "Usage: giveall [player] [amount]", - "item": "Giving all items...", - "done": "Giving all items done", + "started": "Receiving all items...", + "success": "Successfully gave all items to %s.", "invalid_amount_or_playerId": "Invalid amount or player ID." }, "giveArtifact": { "usage": "Usage: giveart|gart [player] <artifactId> <mainPropId> [<appendPropId>[,<times>]]... [level]", - "invalid_artifact_id": "Invalid artifact ID.", - "given": "Given %s to %s." + "id_error": "Invalid artifact ID.", + "success": "Given %s to %s." }, "giveChar": { "usage": "Usage: givechar <player> <itemId|itemName> [amount]", @@ -169,17 +170,18 @@ }, "killCharacter": { "usage": "Usage: /killcharacter [playerId]", - "current_character": "Killed %s current character." + "success": "Killed %s's current character." }, "list": { - "message": "There are %s player(s) online:" + "success": "There are %s player(s) online:" }, "permission": { "usage": "Usage: permission <add|remove> <username> <permission>", "add": "Permission added.", - "have_permission": "They already have this permission!", + "has_error": "They already have this permission!", "remove": "Permission removed.", - "not_have_permission": "They don't have this permission!" + "not_have_error": "They don't have this permission!", + "account_error": "The account cannot be found." }, "position": { "success": "Coordinates: %.3f, %.3f, %.3f\nScene id: %d" @@ -219,13 +221,13 @@ }, "sendMessage": { "usage": "Usage: sendmessage <player> <message>", - "message_sent": "Message sent." + "success": "Message sent." }, "setFetterLevel": { "usage": "Usage: setfetterlevel <level>", - "fetter_level_must_between_0_and_10": "Fetter level must be between 0 and 10.", - "fetter_set_level": "Fetter level set to %s", - "invalid_fetter_level": "Invalid fetter level." + "range_error": "Fetter level must be between 0 and 10.", + "success": "Fetter level set to %s", + "level_error": "Invalid fetter level." }, "setStats": { "usage_console": "Usage: setstats|stats @<UID> <stat> <value>", @@ -240,16 +242,16 @@ }, "setWorldLevel": { "usage": "Usage: setworldlevel <level>", - "world_level_must_between_0_and_8": "World level must be between 0-8", - "set_world_level": "World level set to %s.", + "value_error": "World level must be between 0-8", + "success": "World level set to %s.", "invalid_world_level": "Invalid world level." }, "spawn": { "usage": "Usage: spawn <entityId> [amount] [level(monster only)]", - "message": "Spawned %s of %s." + "success": "Spawned %s of %s." }, "stop": { - "message": "Server shutting down..." + "success": "Server shutting down..." }, "talent": { "usage_1": "To set talent level: /talent set <talentID> <value>", @@ -268,18 +270,19 @@ "q_skill_id": "Q skill ID %s." }, "teleportAll": { - "message": "You only can use this command in MP mode." + "success": "Summoned all players to your location.", + "error": "You only can use this command in MP mode." }, "teleport": { "usage_server": "Usage: /tp @<player id> <x> <y> <z> [scene id]", "usage": "Usage: /tp [@<player id>] <x> <y> <z> [scene id]", "specify_player_id": "You must specify a player id.", "invalid_position": "Invalid position.", - "message": "Teleported %s to %s,%s,%s in scene %s" + "success": "Teleported %s to %s, %s, %s in scene %s" }, "weather": { "usage": "Usage: weather <weatherId> [climateId]", - "message": "Changed weather to %s with climate %s", + "success": "Changed weather to %s with climate %s", "invalid_id": "Invalid ID." }, "drop": { From f39cc9e01fcc6b801662c6229031b29d1eb951ff Mon Sep 17 00:00:00 2001 From: KingRainbow44 <kobedo11@gmail.com> Date: Fri, 6 May 2022 18:56:19 -0400 Subject: [PATCH 18/39] Add the `zh-TW` language. --- Grasscutter.iml | 865 ++++++++++++++++++++++++ Grasscutter.ipr | 104 +++ Grasscutter.iws | 207 ++++++ grasscutter-1.0.3-dev.jar.asc | 14 + src/main/resources/languages/zh-TW.json | 298 ++++++++ 5 files changed, 1488 insertions(+) create mode 100644 Grasscutter.iml create mode 100644 Grasscutter.ipr create mode 100644 Grasscutter.iws create mode 100644 grasscutter-1.0.3-dev.jar.asc create mode 100644 src/main/resources/languages/zh-TW.json diff --git a/Grasscutter.iml b/Grasscutter.iml new file mode 100644 index 000000000..0f136c501 --- /dev/null +++ b/Grasscutter.iml @@ -0,0 +1,865 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module relativePaths="true" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output/> + <orderEntry type="inheritedJdk"/> + <content url="file://$MODULE_DIR$/"> + <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false"/> + <sourceFolder url="file://$MODULE_DIR$/proto" isTestSource="false"/> + <sourceFolder url="file://$MODULE_DIR$/src/main/proto" isTestSource="false"/> + <sourceFolder url="file://$MODULE_DIR$/src/generated" isTestSource="false"/> + <sourceFolder url="file://$MODULE_DIR$/build/extracted-include-protos/main" isTestSource="false" generated="true"/> + <sourceFolder url="file://$MODULE_DIR$/build/extracted-protos/main" isTestSource="false" generated="true"/> + <sourceFolder url="file://$MODULE_DIR$/src/generated/main/java" isTestSource="false" generated="true"/> + <sourceFolder url="file://$MODULE_DIR$/src/test/proto" isTestSource="true"/> + <sourceFolder url="file://$MODULE_DIR$/build/extracted-include-protos/test" isTestSource="true" generated="true"/> + <sourceFolder url="file://$MODULE_DIR$/build/extracted-protos/test" isTestSource="true" generated="true"/> + <sourceFolder url="file://$MODULE_DIR$/src/generated/test/java" isTestSource="true" generated="true"/> + <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource"/> + <excludeFolder url="file://$MODULE_DIR$/.gradle"/> + <excludeFolder url="file://$MODULE_DIR$/build"/> + </content> + <orderEntry type="sourceFolder" forTests="false"/> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.2.9/7d495522b08a9a66084bf417e70eedf95ef706bc/logback-classic-1.2.9.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.2.9/e62ec78303270aefa40721154dc591b9c86072b8/logback-classic-1.2.9-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.reflections/reflections/0.10.2/b638d7ca0e0fe0146b60a0e7ba232ad852a73b31/reflections-0.10.2.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.reflections/reflections/0.10.2/68391d7abbca924e397401333c5a9492531812b6/reflections-0.10.2-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/dev.morphia.morphia/morphia-core/2.2.6/8dd21dd7e49cc78d8e726e236bdcd28510ad776a/morphia-core-2.2.6.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/dev.morphia.morphia/morphia-core/2.2.6/7364d3ec3ff8083a6c8263e26c8459ca9908278f/morphia-core-2.2.6-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.quartz-scheduler/quartz/2.3.2/18a6d6b5a40b77bd060b34cb9f2acadc4bae7c8a/quartz-2.3.2.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.quartz-scheduler/quartz/2.3.2/c22b720ab9a92367424cda3d628fea758dd7e4cf/quartz-2.3.2-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.zaxxer/HikariCP-java7/2.4.13/3e441eddedb374d4de8e3abbb0c90997f51cc97b/HikariCP-java7-2.4.13.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.zaxxer/HikariCP-java7/2.4.13/fc995c9e7945c5d9efa11fdbb5cbf10606409cd5/HikariCP-java7-2.4.13-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.36/6c62681a2f655b49963a5983b8b0950a6120ae14/slf4j-api-1.7.36.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.36/ae9c1aae0033af915cfa75d850eb9d880f21a701/slf4j-api-1.7.36-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-core/1.2.9/cdaca0cf922c5791a8efa0063ec714ca974affe3/logback-core-1.2.9.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-core/1.2.9/92412f3c48649ab2dbe036dd9a57af0a741cb27e/logback-core-1.2.9-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-all/4.1.71.Final/8c89f16505b815e966bb1d4bf4681bdd3701b8b1/netty-all-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES/> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.8.8/431fc3cbc0ff81abdbfde070062741089c3ba874/gson-2.8.8.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.8.8/c0f02b42d0474823279fc9606a81338896d59941/gson-2.8.8-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.protobuf/protobuf-java/3.18.2/17e444501d7ed8dd1f6348f5bc0ad627200defa8/protobuf-java-3.18.2.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.protobuf/protobuf-java/3.18.2/2f741dd5fdc324ed91ac2916573a199302397d75/protobuf-java-3.18.2-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.greenrobot/eventbus-java/3.3.1/74487b0caceca6fcd1aff45d41a9cdc6910d7f5a/eventbus-java-3.3.1.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.greenrobot/eventbus-java/3.3.1/d59e3be28ebbbc065159aabfa9e066edb584baf2/eventbus-java-3.3.1-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.danilopianini/java-quadtree/0.1.9/3eb9cde063327dfefa62e281f7858b44d6d90006/java-quadtree-0.1.9.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.danilopianini/java-quadtree/0.1.9/9a127c827d012257fb39607dc9c56a911e6de482/java-quadtree-0.1.9-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.quartz-scheduler/quartz-jobs/2.3.2/b2223bd809ffc77d41a2739fde85b822e59be2fe/quartz-jobs-2.3.2.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.quartz-scheduler/quartz-jobs/2.3.2/26358986162924db92d4205754c37d213065f388/quartz-jobs-2.3.2-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-buffer/4.1.71.Final/258d8d0ae50a6dc86cb7e8bf4a0599a19c4d81a6/netty-buffer-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-buffer/4.1.71.Final/f775ec95e32721f5f4bda7b03db22d54af31466e/netty-buffer-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec/4.1.71.Final/f9c240be81796f4161f842ed5a50159635e4b621/netty-codec-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec/4.1.71.Final/24fdc51ce7511ad0a350214a1f9bfe046603db17/netty-codec-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-dns/4.1.71.Final/c83d4c0249a46a72c7517a1fed73034b01909a8c/netty-codec-dns-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-dns/4.1.71.Final/364b0da4f0f8765524a45ad73b3fd0c967c6e5e8/netty-codec-dns-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-haproxy/4.1.71.Final/c87961e46e4954a1bd08ab56a75dc4e0896cba2c/netty-codec-haproxy-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-haproxy/4.1.71.Final/be254ca4ce9fd07006e507b1c8cb89ee1fbb02dc/netty-codec-haproxy-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-http/4.1.71.Final/8348b70fc1122d53c9d610b1142d427e0498c254/netty-codec-http-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-http/4.1.71.Final/7b2203aab395340cc542157eb2dc7a16cffe9a1a/netty-codec-http-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-http2/4.1.71.Final/4183c2585fbb39e8b1fa0be4df555b547f388224/netty-codec-http2-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-http2/4.1.71.Final/bd69f23e68ede30bfd2232e2473129555ea592e6/netty-codec-http2-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-memcache/4.1.71.Final/11cd190efc6630276c9ef7987818908b4969f76/netty-codec-memcache-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-memcache/4.1.71.Final/202faae4ada353f287ccfcd4d2f05948c44bb796/netty-codec-memcache-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-mqtt/4.1.71.Final/7f1ece34442b861146a2df537c75d6c7fb3429/netty-codec-mqtt-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-mqtt/4.1.71.Final/fb892a7a47ca26d085816f27340cfa8e946b80e8/netty-codec-mqtt-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-redis/4.1.71.Final/2957506e7956762c385368f2eebdc15995dc3723/netty-codec-redis-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-redis/4.1.71.Final/37997fcea14d0ae2edfb5ab4bd2dd00d94ac5e0a/netty-codec-redis-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-smtp/4.1.71.Final/6410470024a9a3d0180ffffb425369758f85270a/netty-codec-smtp-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-smtp/4.1.71.Final/ab4cb436094b86530cb7b02b9621f173e911d506/netty-codec-smtp-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-socks/4.1.71.Final/5805dc9258561523d86194c71f27f073d8290def/netty-codec-socks-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-socks/4.1.71.Final/d6e6689cf2210621e74fd0faed1ff0eb12e8f254/netty-codec-socks-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-stomp/4.1.71.Final/32ecfa00d63f13ebf6abc49d90db8c93acb6a61e/netty-codec-stomp-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-stomp/4.1.71.Final/c54fefd79298e7f0876f6628a18125ab45686e23/netty-codec-stomp-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-xml/4.1.71.Final/14582c55d9c2cf2152a9e75f64e4ddf947011d69/netty-codec-xml-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-xml/4.1.71.Final/18b3334ad3caefd6afde9ae0ad660d7ec0267bf5/netty-codec-xml-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-common/4.1.71.Final/34ef24f5297849007b8e9ae1884606fd95ef35d4/netty-common-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-common/4.1.71.Final/510df79ad2c1d24fa7a5bf88fddd8cc5bb194ef2/netty-common-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-handler/4.1.71.Final/fff73340583f277dd74c7145aa748c72f75a71d/netty-handler-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-handler/4.1.71.Final/584e59d7caab701ae81ce86ee27a85a37f7c5a97/netty-handler-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-tcnative-classes/2.0.46.Final/9937a832d9c19861822d345b48ced388b645aa5f/netty-tcnative-classes-2.0.46.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-tcnative-classes/2.0.46.Final/fd5373f574ac969627d50ee013c81384ec99ec5e/netty-tcnative-classes-2.0.46.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-handler-proxy/4.1.71.Final/67eb43b6306d1dbc5ccc3ba03a38d9209b6ecc42/netty-handler-proxy-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-handler-proxy/4.1.71.Final/fe3c2143f79a3670a8892645f9e3f747f3dc39cf/netty-handler-proxy-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver/4.1.71.Final/d4b5377a9bf78015125d5da070b48a4d8d85433e/netty-resolver-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver/4.1.71.Final/2050e67851609465c34122c5854fd0a7668b5aa/netty-resolver-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver-dns/4.1.71.Final/89e15f63a6d93ff392cf61704fc6a8361252ae6b/netty-resolver-dns-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver-dns/4.1.71.Final/94e51791bdb84b5d8ddea02306abc7fa56f51e9e/netty-resolver-dns-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport/4.1.71.Final/c7d0d89b26b844fabfba68093945fb2703d89761/netty-transport-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport/4.1.71.Final/3e12d0992805c120c63de2e74c42087e7d2ab0fe/netty-transport-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-rxtx/4.1.71.Final/c4016b4611a62babfb5da937fbcdc1e046bc27df/netty-transport-rxtx-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-rxtx/4.1.71.Final/281abf4f5803e89270a360651eb4a31ef4d83d0/netty-transport-rxtx-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-sctp/4.1.71.Final/473decc08e25a56ad4b4ae7b67efaac7f320738f/netty-transport-sctp-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-sctp/4.1.71.Final/4fda9884d382a7618e21e633323a651dc9f34a1a/netty-transport-sctp-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-udt/4.1.71.Final/33cd943c7ad645e6c3f1f6ac3a3bd24a0e967a37/netty-transport-udt-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-udt/4.1.71.Final/8d1508b1d67f1948fab938ad4cb473ecf19ce461/netty-transport-udt-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-classes-epoll/4.1.71.Final/c82ed86945dc91fcbacdad7660746657429a67ad/netty-transport-classes-epoll-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-classes-epoll/4.1.71.Final/877a00bc0a03fb1829ddeadb7e88a31ee8a498dc/netty-transport-classes-epoll-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-unix-common/4.1.71.Final/d7adb0d02ce6bb20a792600b52e353aec65dae86/netty-transport-native-unix-common-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-unix-common/4.1.71.Final/1fcf098126587648d5b8925715d47dd2d0e641cb/netty-transport-native-unix-common-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-classes-kqueue/4.1.71.Final/198df3a7c43c8e7b2c41c8ae9cf3175c30945e0b/netty-transport-classes-kqueue-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-classes-kqueue/4.1.71.Final/ed18a73c341e1d15f9c1bf87a6a7500fc355b004/netty-transport-classes-kqueue-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver-dns-classes-macos/4.1.71.Final/e4ff273f3bbe438f39b0ba14ee1d981a86b17845/netty-resolver-dns-classes-macos-4.1.71.Final.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver-dns-classes-macos/4.1.71.Final/35d17a0161ebdc9b20d94e6f2790f5de1740ca28/netty-resolver-dns-classes-macos-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.javassist/javassist/3.28.0-GA/9a958811a88381bb159cc2f5ed79c34a45c4af7a/javassist-3.28.0-GA.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.javassist/javassist/3.28.0-GA/4e112a71eca1bebcadd85c5a07a9a26265eb12f4/javassist-3.28.0-GA-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.github.spotbugs/spotbugs-annotations/3.1.9/2ef5127efcc1a899aab8c66d449a631c9a99c469/spotbugs-annotations-3.1.9.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.github.spotbugs/spotbugs-annotations/3.1.9/6f3558917456604d0d70f416c4a834db8e579843/spotbugs-annotations-3.1.9-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.code.findbugs/jsr305/3.0.2/25ea2e8b0c338a877313bd4672d3fe056ea78f0d/jsr305-3.0.2.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.code.findbugs/jsr305/3.0.2/b19b5927c2c25b6c70f093767041e641ae0b1b35/jsr305-3.0.2-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.mongodb/mongodb-driver-legacy/4.2.2/26df40b6d9e8ccb823c29dcf23ba284e41c9bf16/mongodb-driver-legacy-4.2.2.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.mongodb/mongodb-driver-legacy/4.2.2/e06ebf99b2c3ac1209a60be17522897f45a53c12/mongodb-driver-legacy-4.2.2-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.mongodb/mongodb-driver-sync/4.2.2/701dc782a41912284c21a76b35e96473550fa5cf/mongodb-driver-sync-4.2.2.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.mongodb/mongodb-driver-sync/4.2.2/6be22c59bec7d4de0fbf55909cb6678bbe7d7ad9/mongodb-driver-sync-4.2.2-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.github.classgraph/classgraph/4.8.78/87ced5cc1843e8c1736d9abc4a481e75558edddb/classgraph-4.8.78.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.github.classgraph/classgraph/4.8.78/6f434d8d9a59dd004099ee2daa6d374834361e9f/classgraph-4.8.78-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/net.bytebuddy/byte-buddy/1.11.3/c2a818c3b71127167edff8b9dd1caa946f1c8c49/byte-buddy-1.11.3.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/net.bytebuddy/byte-buddy/1.11.3/fedff48c9c601470f4d31cbc96e16450334b056c/byte-buddy-1.11.3-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/5991ca87ef1fb5544943d9abc5a9a37583fabe03/annotations-13.0-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.mchange/c3p0/0.9.5.4/a21a1d37ae0b59efce99671544f51c34ed1e8def/c3p0-0.9.5.4.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.mchange/c3p0/0.9.5.4/c3bebeb3a803901e8bb0707cb85abe22232fee9a/c3p0-0.9.5.4-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.mchange/mchange-commons-java/0.2.15/6ef5abe5f1b94ac45b7b5bad42d871da4fda6bbc/mchange-commons-java-0.2.15.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.mchange/mchange-commons-java/0.2.15/dbcfc59448950a4899d9ad88f0a916d5f1e420a0/mchange-commons-java-0.2.15-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.mongodb/mongodb-driver-core/4.2.2/1b67153f73a3bcaa94b204cd40543e377ccd7c02/mongodb-driver-core-4.2.2.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.mongodb/mongodb-driver-core/4.2.2/bb57fdf7ab9287c19da557cbfe798b8157e4287f/mongodb-driver-core-4.2.2-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.mongodb/bson/4.2.2/56413d45800ef7391bb038095996f1a659cd8a80/bson-4.2.2.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.mongodb/bson/4.2.2/d6cbe13a51e8871a51e3fe9d74526ac3c8fa6584/bson-4.2.2-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/fastutil-mini-8.5.6.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES/> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/kcp-netty.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES/> + </library> + </orderEntry> + <orderEntry type="module-library" scope="RUNTIME"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-epoll/4.1.71.Final/2241265a918eddaace47d238422950cc17370571/netty-transport-native-epoll-4.1.71.Final-linux-x86_64.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-epoll/4.1.71.Final/f0ae9b17d5bc17bc6068b966517ae150a66d5a2b/netty-transport-native-epoll-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library" scope="RUNTIME"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-epoll/4.1.71.Final/39cbedb9312eae8d9e4622c313f22dfef4106149/netty-transport-native-epoll-4.1.71.Final-linux-aarch_64.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-epoll/4.1.71.Final/f0ae9b17d5bc17bc6068b966517ae150a66d5a2b/netty-transport-native-epoll-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library" scope="RUNTIME"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-kqueue/4.1.71.Final/a7e9bbf9c30db70d5b22ed4c8208b156fcf9cc89/netty-transport-native-kqueue-4.1.71.Final-osx-x86_64.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-kqueue/4.1.71.Final/af5357636d3a98802de915e66be10513cfedfe64/netty-transport-native-kqueue-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library" scope="RUNTIME"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-kqueue/4.1.71.Final/70e613f1023e6118097a6431b5c4608605453679/netty-transport-native-kqueue-4.1.71.Final-osx-aarch_64.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-kqueue/4.1.71.Final/af5357636d3a98802de915e66be10513cfedfe64/netty-transport-native-kqueue-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library" scope="RUNTIME"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver-dns-native-macos/4.1.71.Final/5f43a8f5d1af42d98d1ed69d8c30f77b4a602747/netty-resolver-dns-native-macos-4.1.71.Final-osx-x86_64.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES/> + </library> + </orderEntry> + <orderEntry type="module-library" scope="RUNTIME"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver-dns-native-macos/4.1.71.Final/63c9f402684ed981ff254d9ba16fe2433ba38b7e/netty-resolver-dns-native-macos-4.1.71.Final-osx-aarch_64.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES/> + </library> + </orderEntry> + <orderEntry type="module-library" scope="RUNTIME"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/31.1-jre/60458f877d055d0c9114d9e1a2efb737b4bc282c/guava-31.1-jre.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/31.1-jre/c388a68bc2b17a314dfa7c769d858ada0fc32dcf/guava-31.1-jre-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library" scope="RUNTIME"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/failureaccess/1.0.1/1dcf1de382a0bf95a3d8b0849546c88bac1292c9/failureaccess-1.0.1.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/failureaccess/1.0.1/1d064e61aad6c51cc77f9b59dc2cccc78e792f5a/failureaccess-1.0.1-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library" scope="RUNTIME"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/b421526c5f297295adef1c886e5246c39d4ac629/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES/> + </library> + </orderEntry> + <orderEntry type="module-library" scope="RUNTIME"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.checkerframework/checker-qual/3.12.0/d5692f0526415fcc6de94bb5bfbd3afd9dd3b3e5/checker-qual-3.12.0.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.checkerframework/checker-qual/3.12.0/10dacb8b36398debceca36cd0db5f3316967f80e/checker-qual-3.12.0-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library" scope="RUNTIME"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.errorprone/error_prone_annotations/2.11.0/c5a0ace696d3f8b1c1d8cc036d8c03cc0cbe6b69/error_prone_annotations-2.11.0.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.errorprone/error_prone_annotations/2.11.0/d060e42b6aa896a3abe2ec612e1cf8cc307f8a49/error_prone_annotations-2.11.0-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library" scope="RUNTIME"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.j2objc/j2objc-annotations/1.3/ba035118bc8bac37d7eff77700720999acd9986d/j2objc-annotations-1.3.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.j2objc/j2objc-annotations/1.3/d26c56180205cbb50447c3eca98ecb617cf9f58b/j2objc-annotations-1.3-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library" scope="TEST"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-epoll/4.1.71.Final/2241265a918eddaace47d238422950cc17370571/netty-transport-native-epoll-4.1.71.Final-linux-x86_64.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-epoll/4.1.71.Final/f0ae9b17d5bc17bc6068b966517ae150a66d5a2b/netty-transport-native-epoll-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library" scope="TEST"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-epoll/4.1.71.Final/39cbedb9312eae8d9e4622c313f22dfef4106149/netty-transport-native-epoll-4.1.71.Final-linux-aarch_64.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-epoll/4.1.71.Final/f0ae9b17d5bc17bc6068b966517ae150a66d5a2b/netty-transport-native-epoll-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library" scope="TEST"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-kqueue/4.1.71.Final/a7e9bbf9c30db70d5b22ed4c8208b156fcf9cc89/netty-transport-native-kqueue-4.1.71.Final-osx-x86_64.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-kqueue/4.1.71.Final/af5357636d3a98802de915e66be10513cfedfe64/netty-transport-native-kqueue-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library" scope="TEST"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-kqueue/4.1.71.Final/70e613f1023e6118097a6431b5c4608605453679/netty-transport-native-kqueue-4.1.71.Final-osx-aarch_64.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-kqueue/4.1.71.Final/af5357636d3a98802de915e66be10513cfedfe64/netty-transport-native-kqueue-4.1.71.Final-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library" scope="TEST"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver-dns-native-macos/4.1.71.Final/5f43a8f5d1af42d98d1ed69d8c30f77b4a602747/netty-resolver-dns-native-macos-4.1.71.Final-osx-x86_64.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES/> + </library> + </orderEntry> + <orderEntry type="module-library" scope="TEST"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver-dns-native-macos/4.1.71.Final/63c9f402684ed981ff254d9ba16fe2433ba38b7e/netty-resolver-dns-native-macos-4.1.71.Final-osx-aarch_64.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES/> + </library> + </orderEntry> + <orderEntry type="module-library" scope="TEST"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/31.1-jre/60458f877d055d0c9114d9e1a2efb737b4bc282c/guava-31.1-jre.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/31.1-jre/c388a68bc2b17a314dfa7c769d858ada0fc32dcf/guava-31.1-jre-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library" scope="TEST"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/failureaccess/1.0.1/1dcf1de382a0bf95a3d8b0849546c88bac1292c9/failureaccess-1.0.1.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/failureaccess/1.0.1/1d064e61aad6c51cc77f9b59dc2cccc78e792f5a/failureaccess-1.0.1-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library" scope="TEST"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/b421526c5f297295adef1c886e5246c39d4ac629/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES/> + </library> + </orderEntry> + <orderEntry type="module-library" scope="TEST"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.checkerframework/checker-qual/3.12.0/d5692f0526415fcc6de94bb5bfbd3afd9dd3b3e5/checker-qual-3.12.0.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.checkerframework/checker-qual/3.12.0/10dacb8b36398debceca36cd0db5f3316967f80e/checker-qual-3.12.0-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library" scope="TEST"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.errorprone/error_prone_annotations/2.11.0/c5a0ace696d3f8b1c1d8cc036d8c03cc0cbe6b69/error_prone_annotations-2.11.0.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.errorprone/error_prone_annotations/2.11.0/d060e42b6aa896a3abe2ec612e1cf8cc307f8a49/error_prone_annotations-2.11.0-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + <orderEntry type="module-library" scope="TEST"> + <library> + <CLASSES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.j2objc/j2objc-annotations/1.3/ba035118bc8bac37d7eff77700720999acd9986d/j2objc-annotations-1.3.jar!/"/> + </CLASSES> + <JAVADOC/> + <SOURCES> + <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.j2objc/j2objc-annotations/1.3/d26c56180205cbb50447c3eca98ecb617cf9f58b/j2objc-annotations-1.3-sources.jar!/"/> + </SOURCES> + </library> + </orderEntry> + </component> + <component name="ModuleRootManager"/> +</module> diff --git a/Grasscutter.ipr b/Grasscutter.ipr new file mode 100644 index 000000000..3759484a6 --- /dev/null +++ b/Grasscutter.ipr @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="CompilerConfiguration"> + <option name="DEFAULT_COMPILER" value="Javac"/> + <resourceExtensions> + <entry name=".+\.(properties|xml|html|dtd|tld)"/> + <entry name=".+\.(gif|png|jpeg|jpg)"/> + </resourceExtensions> + <wildcardResourcePatterns> + <entry name="!?*.class"/> + <entry name="!?*.scala"/> + <entry name="!?*.groovy"/> + <entry name="!?*.java"/> + </wildcardResourcePatterns> + <annotationProcessing enabled="false" useClasspath="true"/> + <bytecodeTargetLevel target="17"/> + </component> + <component name="CopyrightManager" default=""> + <module2copyright/> + </component> + <component name="DependencyValidationManager"> + <option name="SKIP_IMPORT_STATEMENTS" value="false"/> + </component> + <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false"/> + <component name="GradleUISettings"> + <setting name="root"/> + </component> + <component name="GradleUISettings2"> + <setting name="root"/> + </component> + <component name="IdProvider" IDEtalkID="11DA1DB66DD62DDA1ED602B7079FE97C"/> + <component name="JavadocGenerationManager"> + <option name="OUTPUT_DIRECTORY"/> + <option name="OPTION_SCOPE" value="protected"/> + <option name="OPTION_HIERARCHY" value="true"/> + <option name="OPTION_NAVIGATOR" value="true"/> + <option name="OPTION_INDEX" value="true"/> + <option name="OPTION_SEPARATE_INDEX" value="true"/> + <option name="OPTION_DOCUMENT_TAG_USE" value="false"/> + <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false"/> + <option name="OPTION_DOCUMENT_TAG_VERSION" value="false"/> + <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true"/> + <option name="OPTION_DEPRECATED_LIST" value="true"/> + <option name="OTHER_OPTIONS" value=""/> + <option name="HEAP_SIZE"/> + <option name="LOCALE"/> + <option name="OPEN_IN_BROWSER" value="true"/> + </component> + <component name="ProjectModuleManager"> + <modules> + <module fileurl="file://$PROJECT_DIR$/Grasscutter.iml" filepath="$PROJECT_DIR$/Grasscutter.iml"/> + </modules> + </component> + <component name="ProjectRootManager" version="2" languageLevel="JDK_17" assert-keyword="true" jdk-15="true" project-jdk-type="JavaSDK" assert-jdk-15="true" project-jdk-name="17"> + <output url="file://$PROJECT_DIR$/out"/> + </component> + <component name="SvnBranchConfigurationManager"> + <option name="mySupportsUserInfoFilter" value="true"/> + </component> + <component name="VcsDirectoryMappings"> + <mapping directory="" vcs=""/> + </component> + <component name="masterDetails"> + <states> + <state key="ArtifactsStructureConfigurable.UI"> + <UIState> + <splitter-proportions> + <SplitterProportionsDataImpl/> + </splitter-proportions> + <settings/> + </UIState> + </state> + <state key="Copyright.UI"> + <UIState> + <splitter-proportions> + <SplitterProportionsDataImpl/> + </splitter-proportions> + </UIState> + </state> + <state key="ProjectJDKs.UI"> + <UIState> + <splitter-proportions> + <SplitterProportionsDataImpl> + <option name="proportions"> + <list> + <option value="0.2"/> + </list> + </option> + </SplitterProportionsDataImpl> + </splitter-proportions> + <last-edited>1.6</last-edited> + </UIState> + </state> + <state key="ScopeChooserConfigurable.UI"> + <UIState> + <splitter-proportions> + <SplitterProportionsDataImpl/> + </splitter-proportions> + <settings/> + </UIState> + </state> + </states> + </component> +</project> diff --git a/Grasscutter.iws b/Grasscutter.iws new file mode 100644 index 000000000..d5bc7591f --- /dev/null +++ b/Grasscutter.iws @@ -0,0 +1,207 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ChangeListManager"> + <option name="TRACKING_ENABLED" value="true"/> + <option name="SHOW_DIALOG" value="false"/> + <option name="HIGHLIGHT_CONFLICTS" value="true"/> + <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false"/> + <option name="LAST_RESOLUTION" value="IGNORE"/> + </component> + <component name="ChangesViewManager" flattened_view="true" show_ignored="false"/> + <component name="CreatePatchCommitExecutor"> + <option name="PATCH_PATH" value=""/> + <option name="REVERSE_PATCH" value="false"/> + </component> + <component name="DaemonCodeAnalyzer"> + <disable_hints/> + </component> + <component name="DebuggerManager"> + <breakpoint_any> + <breakpoint> + <option name="NOTIFY_CAUGHT" value="true"/> + <option name="NOTIFY_UNCAUGHT" value="true"/> + <option name="ENABLED" value="false"/> + <option name="LOG_ENABLED" value="false"/> + <option name="LOG_EXPRESSION_ENABLED" value="false"/> + <option name="SUSPEND_POLICY" value="SuspendAll"/> + <option name="COUNT_FILTER_ENABLED" value="false"/> + <option name="COUNT_FILTER" value="0"/> + <option name="CONDITION_ENABLED" value="false"/> + <option name="CLASS_FILTERS_ENABLED" value="false"/> + <option name="INSTANCE_FILTERS_ENABLED" value="false"/> + <option name="CONDITION" value=""/> + <option name="LOG_MESSAGE" value=""/> + </breakpoint> + <breakpoint> + <option name="NOTIFY_CAUGHT" value="true"/> + <option name="NOTIFY_UNCAUGHT" value="true"/> + <option name="ENABLED" value="false"/> + <option name="LOG_ENABLED" value="false"/> + <option name="LOG_EXPRESSION_ENABLED" value="false"/> + <option name="SUSPEND_POLICY" value="SuspendAll"/> + <option name="COUNT_FILTER_ENABLED" value="false"/> + <option name="COUNT_FILTER" value="0"/> + <option name="CONDITION_ENABLED" value="false"/> + <option name="CLASS_FILTERS_ENABLED" value="false"/> + <option name="INSTANCE_FILTERS_ENABLED" value="false"/> + <option name="CONDITION" value=""/> + <option name="LOG_MESSAGE" value=""/> + </breakpoint> + </breakpoint_any> + <breakpoint_rules/> + <ui_properties/> + </component> + <component name="ModuleEditorState"> + <option name="LAST_EDITED_MODULE_NAME"/> + <option name="LAST_EDITED_TAB_NAME"/> + </component> + <component name="ProjectInspectionProfilesVisibleTreeState"> + <entry key="Project Default"> + <profile-state/> + </entry> + </component> + <component name="ProjectLevelVcsManager"> + <OptionsSetting value="true" id="Add"/> + <OptionsSetting value="true" id="Remove"/> + <OptionsSetting value="true" id="Checkout"/> + <OptionsSetting value="true" id="Update"/> + <OptionsSetting value="true" id="Status"/> + <OptionsSetting value="true" id="Edit"/> + <ConfirmationsSetting value="0" id="Add"/> + <ConfirmationsSetting value="0" id="Remove"/> + </component> + <component name="ProjectReloadState"> + <option name="STATE" value="0"/> + </component> + <component name="PropertiesComponent"> + <property name="GoToFile.includeJavaFiles" value="false"/> + <property name="GoToClass.toSaveIncludeLibraries" value="false"/> + <property name="MemberChooser.sorted" value="false"/> + <property name="MemberChooser.showClasses" value="true"/> + <property name="GoToClass.includeLibraries" value="false"/> + <property name="MemberChooser.copyJavadoc" value="false"/> + </component> + <component name="RunManager"> + <configuration default="true" type="Remote" factoryName="Remote"> + <option name="USE_SOCKET_TRANSPORT" value="true"/> + <option name="SERVER_MODE" value="false"/> + <option name="SHMEM_ADDRESS" value="javadebug"/> + <option name="HOST" value="localhost"/> + <option name="PORT" value="5005"/> + <method> + <option name="BuildArtifacts" enabled="false"/> + </method> + </configuration> + <configuration default="true" type="Applet" factoryName="Applet"> + <module name=""/> + <option name="MAIN_CLASS_NAME"/> + <option name="HTML_FILE_NAME"/> + <option name="HTML_USED" value="false"/> + <option name="WIDTH" value="400"/> + <option name="HEIGHT" value="300"/> + <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy"/> + <option name="VM_PARAMETERS"/> + <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false"/> + <option name="ALTERNATIVE_JRE_PATH"/> + <method> + <option name="BuildArtifacts" enabled="false"/> + <option name="Make" enabled="true"/> + </method> + </configuration> + <configuration default="true" type="Application" factoryName="Application"> + <extension name="coverage" enabled="false" merge="false"/> + <option name="MAIN_CLASS_NAME"/> + <option name="VM_PARAMETERS"/> + <option name="PROGRAM_PARAMETERS"/> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$"/> + <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false"/> + <option name="ALTERNATIVE_JRE_PATH"/> + <option name="ENABLE_SWING_INSPECTOR" value="false"/> + <option name="ENV_VARIABLES"/> + <option name="PASS_PARENT_ENVS" value="true"/> + <module name=""/> + <envs/> + <method> + <option name="BuildArtifacts" enabled="false"/> + <option name="Make" enabled="true"/> + </method> + </configuration> + <configuration default="true" type="JUnit" factoryName="JUnit"> + <extension name="coverage" enabled="false" merge="false"/> + <module name=""/> + <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false"/> + <option name="ALTERNATIVE_JRE_PATH"/> + <option name="PACKAGE_NAME"/> + <option name="MAIN_CLASS_NAME"/> + <option name="METHOD_NAME"/> + <option name="TEST_OBJECT" value="class"/> + <option name="VM_PARAMETERS"/> + <option name="PARAMETERS"/> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$"/> + <option name="ENV_VARIABLES"/> + <option name="PASS_PARENT_ENVS" value="true"/> + <option name="TEST_SEARCH_SCOPE"> + <value defaultName="moduleWithDependencies"/> + </option> + <envs/> + <method> + <option name="BuildArtifacts" enabled="false"/> + <option name="Make" enabled="true"/> + </method> + </configuration> + <list size="0"/> + <configuration name="<template>" type="WebApp" default="true" selected="false"> + <Host>localhost</Host> + <Port>5050</Port> + </configuration> + </component> + <component name="ShelveChangesManager" show_recycled="false"/> + <component name="SvnConfiguration" maxAnnotateRevisions="500"> + <option name="USER" value=""/> + <option name="PASSWORD" value=""/> + <option name="LAST_MERGED_REVISION"/> + <option name="UPDATE_RUN_STATUS" value="false"/> + <option name="MERGE_DRY_RUN" value="false"/> + <option name="MERGE_DIFF_USE_ANCESTRY" value="true"/> + <option name="UPDATE_LOCK_ON_DEMAND" value="false"/> + <option name="IGNORE_SPACES_IN_MERGE" value="false"/> + <option name="DETECT_NESTED_COPIES" value="true"/> + <option name="IGNORE_SPACES_IN_ANNOTATE" value="true"/> + <option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true"/> + <myIsUseDefaultProxy>false</myIsUseDefaultProxy> + </component> + <component name="TaskManager"> + <task active="true" id="Default" summary="Default task"/> + <servers/> + </component> + <component name="VcsManagerConfiguration"> + <option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true"/> + <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true"/> + <option name="PERFORM_UPDATE_IN_BACKGROUND" value="true"/> + <option name="PERFORM_COMMIT_IN_BACKGROUND" value="true"/> + <option name="PERFORM_EDIT_IN_BACKGROUND" value="true"/> + <option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true"/> + <option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true"/> + <option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false"/> + <option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false"/> + <option name="ENABLE_BACKGROUND_PROCESSES" value="false"/> + <option name="CHANGED_ON_SERVER_INTERVAL" value="60"/> + <option name="FORCE_NON_EMPTY_COMMENT" value="false"/> + <option name="LAST_COMMIT_MESSAGE"/> + <option name="MAKE_NEW_CHANGELIST_ACTIVE" value="true"/> + <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false"/> + <option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false"/> + <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false"/> + <option name="REFORMAT_BEFORE_FILE_COMMIT" value="false"/> + <option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8"/> + <option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5"/> + <option name="ACTIVE_VCS_NAME"/> + <option name="UPDATE_GROUP_BY_PACKAGES" value="false"/> + <option name="UPDATE_GROUP_BY_CHANGELIST" value="false"/> + <option name="SHOW_FILE_HISTORY_AS_TREE" value="false"/> + <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6"/> + </component> + <component name="XDebuggerManager"> + <breakpoint-manager/> + </component> +</project> diff --git a/grasscutter-1.0.3-dev.jar.asc b/grasscutter-1.0.3-dev.jar.asc new file mode 100644 index 000000000..0249d0297 --- /dev/null +++ b/grasscutter-1.0.3-dev.jar.asc @@ -0,0 +1,14 @@ +-----BEGIN PGP SIGNATURE----- +Version: BCPG v1.68 + +iQGcBAABCgAGBQJicbItAAoJEK1DoRSUkxpGzZgMAJaxuuXmG3V1gFdJLXoKR+6s +moOjwyD8UDfFModX92Thccgox9/j72A1x8sKQfJNDzI5wx51iR2rXw52KE6GhdVI +vSyhnGv6LGOtGtA59i8wnXcEKBD33Qm6B2KFD4ox4JEheMb/wWK3zF09aknLkUVX +43L48E4dF0lAzJ7QWZTTNKCK156Bwa3F8NhVLGGD6tpGahkS8J73Ax6C8uu6zVKf +8dftBpI+0YxPJkbxoPahVZVmFawUjcjPDcRwG5LTO6McVUI9YzczSHdk0FG39ENo +HXvwsK/xnN2Xy8ta+ylu9Eta0zx9mLTZjEjUQ3B8XjTDDVcz11DlvE5L1jJ8Gov+ +XbCM0m+od0hziCwuYg2BOsi13C9vejA5BoCHeejNTy+QiGGhK4QdyxdufxQD1Bo4 +uF8ZmmeC1AMA7m1y4tqIqwA5iJQx4KaB3aKw8np0bYuVVNnw75wpf3NBcQKW/Jf7 +diKjcimqhSkPpJ/ok0ZqITpMTaYhZoXnyUFsm0DIHA== +=5WgW +-----END PGP SIGNATURE----- diff --git a/src/main/resources/languages/zh-TW.json b/src/main/resources/languages/zh-TW.json new file mode 100644 index 000000000..22d1339c8 --- /dev/null +++ b/src/main/resources/languages/zh-TW.json @@ -0,0 +1,298 @@ +{ + "messages": { + "game": { + "port_bind": "遊戲伺服器已成功啟動。端口號:%s", + "connect": "客戶端已連接至 %s", + "disconnect": "客戶端 %s 已斷開連接。", + "game_update_error": "遊戲更新時發生了錯誤。", + "command_error": "指令發生錯誤:" + }, + "dispatch": { + "port_bind": "[Dispatch] 伺服器已在端口 %s 上開啟。", + "request": "[Dispatch] 客戶端 %s 請求: %s %s", + "keystore": { + "general_error": "[Dispatch] 加載keystore文件時發生錯誤!", + "password_error": "[Dispatch] 加載 keystore 失敗。正在嘗試使用預設 keystore 密碼...", + "no_keystore_error": "[Dispatch] 未找到 SSL 憑證!已後降到 HTTP 伺服器。", + "default_password": "[Dispatch] 默認的 keystore 密碼加載成功。請考慮將 config.json 的憑證密碼設定成 123456。" + }, + "no_commands_error": "此指令不適用於Dispatch-only模式。", + "unhandled_request_error": "[Dispatch] 潛在的未處理請求 %s 請求:%s", + "account": { + "login_attempt": "[Dispatch] 客戶端 %s 正在嘗試登入", + "login_success": "[Dispatch] 客戶端 %s 已登入,UID為 %s", + "login_token_attempt": "[Dispatch] 客戶端 %s 正在嘗試用憑證登入", + "login_token_error": "[Dispatch] 客戶端 %s 使用憑證登入失敗", + "login_token_success": "[Dispatch] 客戶端 %s 已透過憑證登入,UID為 %s", + "combo_token_success": "[Dispatch] 客戶端 %s 交換憑證成功", + "combo_token_error": "[Dispatch] 客戶端 %s 交換憑證失敗", + "account_login_create_success": "[Dispatch] 客戶端 %s 登入失敗: 已註冊UID為 %s 的帳號", + "account_login_create_error": "[Dispatch] 客戶端 %s 登入失敗:帳號建立失敗。", + "account_login_exist_error": "[Dispatch] 客戶端 %s 登入失敗: 帳號不存在", + "account_cache_error": "遊戲帳號緩存資訊錯誤", + "session_key_error": "對話密鑰不符。", + "username_error": "未找到此用戶名。", + "username_create_error": "未找到用戶名,建立失敗。" + } + }, + "status": { + "free_software": "Grasscutter 是免費開源軟體。如果你已經付錢了,那你可能被騙了。主頁:https://github.com/Grasscutters/Grasscutter", + "starting": "正在啟動 Grasscutter...", + "shutdown": "正在關閉...", + "done": "加載完成!需要指令幫助請輸入 \"help\"", + "error": "發生了一個錯誤。", + "welcome": "歡迎使用 Grasscutter", + "run_mode_error": "無效的伺服器運行模式: %s。", + "run_mode_help": "伺服器運行模式必須為 HYBRID 或者 DISPATCH_ONLY 或者 GAME_ONLY。Grasscutter 啟動失敗...", + "create_resources": "正在建立 resources 資料夾...", + "resources_error": "請將 BinOutput 和 ExcelBinOutput 複製到 resources 資料夾。" + } + }, + "commands": { + "generic": { + "not_specified": "沒有指定指令。", + "unknown_command": "未知的指令:%s", + "permission_error": "您沒有執行此指令的權限。", + "console_execute_error": "此指令只能在伺服器的命令提示字元執行。", + "player_execute_error": "請在遊戲裡使用這條指令。", + "command_exist_error": "找不到指令。", + "invalid": { + "amount": "無效的 數量.", + "artifactId": "無效的聖遺物ID。", + "avatarId": "無效的角色ID。", + "avatarLevel": "無效的角色等級。", + "entityId": "無效的實體ID。", + "itemId": "無效的物品ID。", + "itemLevel": "無效的物品等級。", + "itemRefinement": "無效的物品精煉度。", + "playerId": "無效的玩家ID。", + "uid": "無效的UID。" + } + }, + "execution": { + "uid_error": "無效的UID。", + "player_exist_error": "用戶不存在。", + "player_offline_error": "玩家已離線。", + "item_id_error": "無效的物品ID。.", + "item_player_exist_error": "無效的物品/玩家UID。", + "entity_id_error": "無效的實體ID。", + "player_exist_offline_error": "玩家不存在或已離線。", + "argument_error": "無效的參數。", + "clear_target": "目標已清除.", + "set_target": "隨後的指令都會以@%s為預設。", + "need_target": "此指令需要一個目標 UID。添加 <@UID> 引數或者使用 /target @UID 來設定持久目標。" + }, + "status": { + "enabled": "已啟用", + "disabled": "未啟用", + "help": "幫助", + "success": "成功" + }, + "account": { + "modify": "修改使用者帳號", + "invalid": "無效的UID。", + "exists": "帳號已存在。", + "create": "已建立帳號,UID 為 %s 。", + "delete": "帳號已刪除。", + "no_account": "帳號不存在。", + "command_usage": "用法:account <create|delete> <username> [uid]" + }, + "broadcast": { + "command_usage": "用法:broadcast <message>", + "message_sent": "公告已發送。" + }, + "changescene": { + "usage": "用法:changescene <scene id>", + "already_in_scene": "你已經在這個場景中了。", + "success": "已切換至場景 %s.", + "exists_error": "此場景不存在。" + }, + "clear": { + "command_usage": "用法: clear <all|wp|art|mat>", + "weapons": "已將 %s 的武器清空。", + "artifacts": "已將 %s 的聖遺物清空。", + "materials": "已將 %s 的材料清空。", + "furniture": "已將 %s 的塵歌壺家具清空。", + "displays": "已清除 %s 的顯示。", + "virtuals": "已將 %s 的所有貨幣和經驗值清空。", + "everything": "已將 %s 的所有物品清空。" + }, + "coop": { + "usage": "用法:coop <playerId> <target playerId>", + "success": "Summoned %s to %s's world." + }, + "enter_dungeon": { + "usage": "用法:enterdungeon <dungeon id>", + "changed": "已進入副本 %s", + "not_found_error": "此副本不存在。", + "in_dungeon_error": "你已經在祕境中了。" + }, + "giveAll": { + "usage": "用法:giveall [player] [amount]", + "started": "正在賦予全部物品...", + "success": "已賦予全部物品。", + "invalid_amount_or_playerId": "無效的數量/玩家ID。" + }, + "giveArtifact": { + "usage": "用法:giveart|gart [player] <artifactId> <mainPropId> [<appendPropId>[,<times>]]... [level]", + "id_error": "無效的聖遺物ID。", + "success": "已把 %s 給予 %s。" + }, + "giveChar": { + "usage": "用法:givechar <player> <itemId|itemName> [amount]", + "given": "Given %s with level %s to %s.", + "invalid_avatar_id": "無效的角色ID。", + "invalid_avatar_level": "無效的角色等級。.", + "invalid_avatar_or_player_id": "無效的角色ID/玩家ID。" + }, + "give": { + "usage": "用法:give <player> <itemId|itemName> [amount] [level]", + "refinement_only_applicable_weapons": "精煉度只能施加在武器上面。", + "refinement_must_between_1_and_5": "精煉度必需在 1 到 5 之間。", + "given": "已經將 %s 個 %s 給予 %s。", + "given_with_level_and_refinement": "已將 %s [等級%s, 精煉%s] %s個給予 %s", + "given_level": "已將 %s 等級 %s %s 個給予 %s" + }, + "godmode": { + "success": "上帝模式設定為 %s 。 [用戶:%s]" + }, + "heal": { + "success": "所有角色已被治療。" + }, + "kick": { + "player_kick_player": "玩家 [%s:%s] 已把 [%s:%s] 踢出", + "server_kick_player": "正在踢出玩家 [%s:%s]" + }, + "kill": { + "usage": "用法:killall [playerUid] [sceneId]", + "scene_not_found_in_player_world": "未在玩家世界中找到此場景", + "kill_monsters_in_scene": "已殺死 %s 個怪物。 [場景ID: %s]" + }, + "killCharacter": { + "usage": "用法:/killcharacter [playerId]", + "success": "已殺死 %s 目前的場上角色。" + }, + "list": { + "message": "目前總線上人數:%s" + }, + "permission": { + "usage": "用法:permission <add|remove> <username> <permission>", + "add": "已指派權限。", + "has_error": "此玩家已擁有權限!", + "remove": "權限已移除。", + "not_have_error": "此玩家未擁有權限!", + "account_error": "The account cannot be found." + }, + "position": { + "success": "坐標:%.3f, %.3f, %.3f\n場景ID:%d" + }, + "reload": { + "reload_start": "正在重新加載設定檔。", + "reload_done": "重新加載已完成。" + }, + "resetConst": { + "reset_all": "重設所有角色的命座。", + "success": "已重設 %s 的命座,重新登入後將會生效。" + }, + "resetShopLimit": { + "usage": "用法:/resetshop <player id>" + }, + "sendMail": { + "usage": "用法:give [player] <itemId|itemName> [amount]", + "user_not_exist": "ID '%s' 的使用者不存在。", + "start_composition": "發送郵件流程。\n請使用`/send <郵件標題>`來進到下一步。\n你可以在任何時間使用`/sendmail stop`來停止發送。", + "templates": "郵件模板尚未實裝...", + "invalid_arguments": "無效的參數。\n指令使用方法 `/sendmail <userId|all|help> [templateId]`", + "send_cancel": "取消傳送信息", + "send_done": "已將消息發送給 %s!", + "send_all_done": "消息已發送給全體用戶!", + "not_composition_end": "現在郵件發送未到最後階段。\n請使用 `/sendmail %s` 繼續發送郵件,或者 `/sendmail stop` 來停止發送郵件。", + "please_use": "請使用 `/sendmail %s`", + "set_title": "成功將郵件標題設定成 '%s'。\n接下來請繼續使用 '/sendmail <content>' 來設定郵件內容。", + "set_contents": "成功將'%s'為郵件內容。\n接下來請打出 '/sendmail <寄件者名稱>' 來設定郵件寄件者名稱。", + "set_message_sender": "郵件寄件者已設為 '%s'。\n使用 '/sendmail <itemId|itemName|finish> [amount] [level]' 以繼續操作。", + "send": "已添加 %s 個 %s (等級為 %s) 到郵件附件。\n如果沒有要繼續添加道具請使用 `/sendmail finish` 來完成郵件發送。", + "invalid_arguments_please_use": "Invalid arguments \n Please use `/sendmail %s`", + "title": "<標題>", + "message": "<正文>", + "sender": "<寄件者>", + "arguments": "<itemId|itemName|finish> [數量] [等級]", + "error": "錯誤:無效的編寫階段 %s。需要 stacktrace 請查看伺服器命令提示字元。" + }, + "sendMessage": { + "usage": "用法:sendmessage <player> <message>", + "success": "訊息已發送。" + }, + "setFetterLevel": { + "usage": "用法:setfetterlevel <level>", + "range_error": "好感度必須在 0 到 10 之間。", + "fetter_set_level": "好感等級已設定為 %s", + "level_error": "無效的好感度。" + }, + "setStats": { + "usage_console": "用法:setstats|stats @<UID> <stat> <value>", + "usage_ingame": "用法:setstats|stats [@UID] <stat> <value>", + "help_message": "\n\t可使用的數據類型:hp (生命值)| maxhp (最大生命值) | def(防禦力) | atk (攻擊力)| em (元素精通) | er (元素充能效率) | crate(暴擊率) | cdmg (暴擊傷害)| cdr (冷卻縮減) | heal(治療加成)| heali (受治療加成)| shield (護盾強效)| defi (無視防禦)\n\t(cont.) 元素增傷類:epyro (火傷) | ecryo (冰傷) | ehydro (水傷) | egeo (岩傷) | edendro (草傷) | eelectro (雷傷) | ephys (物傷)(cont.) 元素減傷類:respyro (火抗) | rescryo (冰抗) | reshydro (水抗) | resgeo (岩抗) | resdendro (草抗) | reselectro (雷抗) | resphys (物抗)\n", + "value_error": "無效的數據值。", + "uid_error": "無效的UID。", + "player_error": "玩家不存在或已離線。", + "set_self": "%s 已經設為 %s。", + "set_for_uid": "%s 的使用者 %s 更改為 %s。", + "set_max_hp": "最大生命值更改為 %s。" + }, + "setWorldLevel": { + "usage": "用法:setworldlevel <level>", + "value_error": "世界等級必須設定在0-8之間。", + "success": "已將世界等級設為%s。", + "invalid_world_level": "無效的世界等級。" + }, + "spawn": { + "usage": "用法:spawn <entityId> [amount] [level(僅限怪物)]", + "success": "已生成 %s 個 %s。" + }, + "stop": { + "success": "正在關閉伺服器..." + }, + "talent": { + "usage_1": "設定天賦等級:/talent set <talentID> <value>", + "usage_2": "另一種設定天賦等級的指令使用方法:/talent <n or e or q> <value>", + "usage_3": "獲取天賦ID指令用法:/talent getid", + "lower_16": "無效的技能等級,技能等級應低於 16。", + "set_id": "將天賦等級設為%s。", + "set_atk": "將普通攻擊等級設為 %s。", + "set_e": "設定天賦E等級至 %s。", + "set_q": "設定天賦Q等級至 %s。", + "invalid_skill_id": "無效的技能ID。", + "set_this": "將天賦等級設為 %s。", + "invalid_level": "無效的天賦等級。", + "normal_attack_id": "普通攻擊的 ID 為 %s。", + "e_skill_id": "E技能ID %s。", + "q_skill_id": "Q技能ID %s。" + }, + "teleportAll": { + "success": "Summoned all players to your location.", + "error": "此指令僅可在多人遊戲下可用。" + }, + "teleport": { + "usage_server": "用法:/tp @<player id> <x> <y> <z> [scene id]", + "usage": "用法:/tp [@<player id>] <x> <y> <z> [scene id]", + "specify_player_id": "你必須指定一個玩家ID。", + "invalid_position": "無效的位置。", + "success": "傳送 %s 到坐標 %s,%s,%s ,場景為 %s" + }, + "weather": { + "usage": "用法:weather <weatherId> [climateId]", + "success": "已將當前天氣設定為 %s ,氣候則為 %s 。", + "invalid_id": "無效的ID。" + }, + "drop": { + "command_usage": "用法:drop <itemId|itemName> [amount]", + "success": "已將 %s x %s 丟在附近。" + }, + "help": { + "usage": "用法:", + "aliases": "別名:", + "available_commands": "可用指令:" + } + } +} \ No newline at end of file From 362cfe1e7bf8f2b3560948097ff05d2086361ec8 Mon Sep 17 00:00:00 2001 From: KingRainbow44 <kobedo11@gmail.com> Date: Fri, 6 May 2022 18:57:49 -0400 Subject: [PATCH 19/39] Ensure we have a fallback for localization --- src/main/java/emu/grasscutter/utils/Language.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/emu/grasscutter/utils/Language.java b/src/main/java/emu/grasscutter/utils/Language.java index 702da202a..c4af257e8 100644 --- a/src/main/java/emu/grasscutter/utils/Language.java +++ b/src/main/java/emu/grasscutter/utils/Language.java @@ -61,7 +61,7 @@ public final class Language { JsonObject object = this.languageData; int index = 0; - String result = ""; + String result = "This value does not exist. Please report this to the Discord: " + key; while (true) { if(index == keys.length) break; From 08882e18aa8233575ac10dc21fb96ff52e5029b1 Mon Sep 17 00:00:00 2001 From: KingRainbow44 <kobedo11@gmail.com> Date: Fri, 6 May 2022 18:59:26 -0400 Subject: [PATCH 20/39] Update .gitignore & remove files --- .gitignore | 2 +- Grasscutter.iml | 865 ---------------------------------- Grasscutter.ipr | 104 ---- Grasscutter.iws | 207 -------- grasscutter-1.0.3-dev.jar.asc | 14 - 5 files changed, 1 insertion(+), 1191 deletions(-) delete mode 100644 Grasscutter.iml delete mode 100644 Grasscutter.ipr delete mode 100644 Grasscutter.iws delete mode 100644 grasscutter-1.0.3-dev.jar.asc diff --git a/.gitignore b/.gitignore index 32987345b..8571ccb88 100644 --- a/.gitignore +++ b/.gitignore @@ -52,7 +52,7 @@ tmp/ .vscode # Grasscutter -resources/ +/resources/ logs/ plugins/ data/AbilityEmbryos.json diff --git a/Grasscutter.iml b/Grasscutter.iml deleted file mode 100644 index 0f136c501..000000000 --- a/Grasscutter.iml +++ /dev/null @@ -1,865 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module relativePaths="true" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="true"> - <exclude-output/> - <orderEntry type="inheritedJdk"/> - <content url="file://$MODULE_DIR$/"> - <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false"/> - <sourceFolder url="file://$MODULE_DIR$/proto" isTestSource="false"/> - <sourceFolder url="file://$MODULE_DIR$/src/main/proto" isTestSource="false"/> - <sourceFolder url="file://$MODULE_DIR$/src/generated" isTestSource="false"/> - <sourceFolder url="file://$MODULE_DIR$/build/extracted-include-protos/main" isTestSource="false" generated="true"/> - <sourceFolder url="file://$MODULE_DIR$/build/extracted-protos/main" isTestSource="false" generated="true"/> - <sourceFolder url="file://$MODULE_DIR$/src/generated/main/java" isTestSource="false" generated="true"/> - <sourceFolder url="file://$MODULE_DIR$/src/test/proto" isTestSource="true"/> - <sourceFolder url="file://$MODULE_DIR$/build/extracted-include-protos/test" isTestSource="true" generated="true"/> - <sourceFolder url="file://$MODULE_DIR$/build/extracted-protos/test" isTestSource="true" generated="true"/> - <sourceFolder url="file://$MODULE_DIR$/src/generated/test/java" isTestSource="true" generated="true"/> - <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource"/> - <excludeFolder url="file://$MODULE_DIR$/.gradle"/> - <excludeFolder url="file://$MODULE_DIR$/build"/> - </content> - <orderEntry type="sourceFolder" forTests="false"/> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.2.9/7d495522b08a9a66084bf417e70eedf95ef706bc/logback-classic-1.2.9.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.2.9/e62ec78303270aefa40721154dc591b9c86072b8/logback-classic-1.2.9-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.reflections/reflections/0.10.2/b638d7ca0e0fe0146b60a0e7ba232ad852a73b31/reflections-0.10.2.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.reflections/reflections/0.10.2/68391d7abbca924e397401333c5a9492531812b6/reflections-0.10.2-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/dev.morphia.morphia/morphia-core/2.2.6/8dd21dd7e49cc78d8e726e236bdcd28510ad776a/morphia-core-2.2.6.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/dev.morphia.morphia/morphia-core/2.2.6/7364d3ec3ff8083a6c8263e26c8459ca9908278f/morphia-core-2.2.6-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.quartz-scheduler/quartz/2.3.2/18a6d6b5a40b77bd060b34cb9f2acadc4bae7c8a/quartz-2.3.2.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.quartz-scheduler/quartz/2.3.2/c22b720ab9a92367424cda3d628fea758dd7e4cf/quartz-2.3.2-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.zaxxer/HikariCP-java7/2.4.13/3e441eddedb374d4de8e3abbb0c90997f51cc97b/HikariCP-java7-2.4.13.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.zaxxer/HikariCP-java7/2.4.13/fc995c9e7945c5d9efa11fdbb5cbf10606409cd5/HikariCP-java7-2.4.13-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.36/6c62681a2f655b49963a5983b8b0950a6120ae14/slf4j-api-1.7.36.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.36/ae9c1aae0033af915cfa75d850eb9d880f21a701/slf4j-api-1.7.36-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-core/1.2.9/cdaca0cf922c5791a8efa0063ec714ca974affe3/logback-core-1.2.9.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-core/1.2.9/92412f3c48649ab2dbe036dd9a57af0a741cb27e/logback-core-1.2.9-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-all/4.1.71.Final/8c89f16505b815e966bb1d4bf4681bdd3701b8b1/netty-all-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES/> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.8.8/431fc3cbc0ff81abdbfde070062741089c3ba874/gson-2.8.8.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.8.8/c0f02b42d0474823279fc9606a81338896d59941/gson-2.8.8-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.protobuf/protobuf-java/3.18.2/17e444501d7ed8dd1f6348f5bc0ad627200defa8/protobuf-java-3.18.2.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.protobuf/protobuf-java/3.18.2/2f741dd5fdc324ed91ac2916573a199302397d75/protobuf-java-3.18.2-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.greenrobot/eventbus-java/3.3.1/74487b0caceca6fcd1aff45d41a9cdc6910d7f5a/eventbus-java-3.3.1.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.greenrobot/eventbus-java/3.3.1/d59e3be28ebbbc065159aabfa9e066edb584baf2/eventbus-java-3.3.1-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.danilopianini/java-quadtree/0.1.9/3eb9cde063327dfefa62e281f7858b44d6d90006/java-quadtree-0.1.9.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.danilopianini/java-quadtree/0.1.9/9a127c827d012257fb39607dc9c56a911e6de482/java-quadtree-0.1.9-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.quartz-scheduler/quartz-jobs/2.3.2/b2223bd809ffc77d41a2739fde85b822e59be2fe/quartz-jobs-2.3.2.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.quartz-scheduler/quartz-jobs/2.3.2/26358986162924db92d4205754c37d213065f388/quartz-jobs-2.3.2-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-buffer/4.1.71.Final/258d8d0ae50a6dc86cb7e8bf4a0599a19c4d81a6/netty-buffer-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-buffer/4.1.71.Final/f775ec95e32721f5f4bda7b03db22d54af31466e/netty-buffer-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec/4.1.71.Final/f9c240be81796f4161f842ed5a50159635e4b621/netty-codec-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec/4.1.71.Final/24fdc51ce7511ad0a350214a1f9bfe046603db17/netty-codec-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-dns/4.1.71.Final/c83d4c0249a46a72c7517a1fed73034b01909a8c/netty-codec-dns-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-dns/4.1.71.Final/364b0da4f0f8765524a45ad73b3fd0c967c6e5e8/netty-codec-dns-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-haproxy/4.1.71.Final/c87961e46e4954a1bd08ab56a75dc4e0896cba2c/netty-codec-haproxy-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-haproxy/4.1.71.Final/be254ca4ce9fd07006e507b1c8cb89ee1fbb02dc/netty-codec-haproxy-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-http/4.1.71.Final/8348b70fc1122d53c9d610b1142d427e0498c254/netty-codec-http-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-http/4.1.71.Final/7b2203aab395340cc542157eb2dc7a16cffe9a1a/netty-codec-http-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-http2/4.1.71.Final/4183c2585fbb39e8b1fa0be4df555b547f388224/netty-codec-http2-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-http2/4.1.71.Final/bd69f23e68ede30bfd2232e2473129555ea592e6/netty-codec-http2-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-memcache/4.1.71.Final/11cd190efc6630276c9ef7987818908b4969f76/netty-codec-memcache-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-memcache/4.1.71.Final/202faae4ada353f287ccfcd4d2f05948c44bb796/netty-codec-memcache-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-mqtt/4.1.71.Final/7f1ece34442b861146a2df537c75d6c7fb3429/netty-codec-mqtt-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-mqtt/4.1.71.Final/fb892a7a47ca26d085816f27340cfa8e946b80e8/netty-codec-mqtt-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-redis/4.1.71.Final/2957506e7956762c385368f2eebdc15995dc3723/netty-codec-redis-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-redis/4.1.71.Final/37997fcea14d0ae2edfb5ab4bd2dd00d94ac5e0a/netty-codec-redis-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-smtp/4.1.71.Final/6410470024a9a3d0180ffffb425369758f85270a/netty-codec-smtp-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-smtp/4.1.71.Final/ab4cb436094b86530cb7b02b9621f173e911d506/netty-codec-smtp-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-socks/4.1.71.Final/5805dc9258561523d86194c71f27f073d8290def/netty-codec-socks-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-socks/4.1.71.Final/d6e6689cf2210621e74fd0faed1ff0eb12e8f254/netty-codec-socks-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-stomp/4.1.71.Final/32ecfa00d63f13ebf6abc49d90db8c93acb6a61e/netty-codec-stomp-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-stomp/4.1.71.Final/c54fefd79298e7f0876f6628a18125ab45686e23/netty-codec-stomp-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-xml/4.1.71.Final/14582c55d9c2cf2152a9e75f64e4ddf947011d69/netty-codec-xml-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-xml/4.1.71.Final/18b3334ad3caefd6afde9ae0ad660d7ec0267bf5/netty-codec-xml-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-common/4.1.71.Final/34ef24f5297849007b8e9ae1884606fd95ef35d4/netty-common-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-common/4.1.71.Final/510df79ad2c1d24fa7a5bf88fddd8cc5bb194ef2/netty-common-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-handler/4.1.71.Final/fff73340583f277dd74c7145aa748c72f75a71d/netty-handler-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-handler/4.1.71.Final/584e59d7caab701ae81ce86ee27a85a37f7c5a97/netty-handler-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-tcnative-classes/2.0.46.Final/9937a832d9c19861822d345b48ced388b645aa5f/netty-tcnative-classes-2.0.46.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-tcnative-classes/2.0.46.Final/fd5373f574ac969627d50ee013c81384ec99ec5e/netty-tcnative-classes-2.0.46.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-handler-proxy/4.1.71.Final/67eb43b6306d1dbc5ccc3ba03a38d9209b6ecc42/netty-handler-proxy-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-handler-proxy/4.1.71.Final/fe3c2143f79a3670a8892645f9e3f747f3dc39cf/netty-handler-proxy-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver/4.1.71.Final/d4b5377a9bf78015125d5da070b48a4d8d85433e/netty-resolver-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver/4.1.71.Final/2050e67851609465c34122c5854fd0a7668b5aa/netty-resolver-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver-dns/4.1.71.Final/89e15f63a6d93ff392cf61704fc6a8361252ae6b/netty-resolver-dns-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver-dns/4.1.71.Final/94e51791bdb84b5d8ddea02306abc7fa56f51e9e/netty-resolver-dns-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport/4.1.71.Final/c7d0d89b26b844fabfba68093945fb2703d89761/netty-transport-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport/4.1.71.Final/3e12d0992805c120c63de2e74c42087e7d2ab0fe/netty-transport-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-rxtx/4.1.71.Final/c4016b4611a62babfb5da937fbcdc1e046bc27df/netty-transport-rxtx-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-rxtx/4.1.71.Final/281abf4f5803e89270a360651eb4a31ef4d83d0/netty-transport-rxtx-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-sctp/4.1.71.Final/473decc08e25a56ad4b4ae7b67efaac7f320738f/netty-transport-sctp-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-sctp/4.1.71.Final/4fda9884d382a7618e21e633323a651dc9f34a1a/netty-transport-sctp-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-udt/4.1.71.Final/33cd943c7ad645e6c3f1f6ac3a3bd24a0e967a37/netty-transport-udt-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-udt/4.1.71.Final/8d1508b1d67f1948fab938ad4cb473ecf19ce461/netty-transport-udt-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-classes-epoll/4.1.71.Final/c82ed86945dc91fcbacdad7660746657429a67ad/netty-transport-classes-epoll-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-classes-epoll/4.1.71.Final/877a00bc0a03fb1829ddeadb7e88a31ee8a498dc/netty-transport-classes-epoll-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-unix-common/4.1.71.Final/d7adb0d02ce6bb20a792600b52e353aec65dae86/netty-transport-native-unix-common-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-unix-common/4.1.71.Final/1fcf098126587648d5b8925715d47dd2d0e641cb/netty-transport-native-unix-common-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-classes-kqueue/4.1.71.Final/198df3a7c43c8e7b2c41c8ae9cf3175c30945e0b/netty-transport-classes-kqueue-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-classes-kqueue/4.1.71.Final/ed18a73c341e1d15f9c1bf87a6a7500fc355b004/netty-transport-classes-kqueue-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver-dns-classes-macos/4.1.71.Final/e4ff273f3bbe438f39b0ba14ee1d981a86b17845/netty-resolver-dns-classes-macos-4.1.71.Final.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver-dns-classes-macos/4.1.71.Final/35d17a0161ebdc9b20d94e6f2790f5de1740ca28/netty-resolver-dns-classes-macos-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.javassist/javassist/3.28.0-GA/9a958811a88381bb159cc2f5ed79c34a45c4af7a/javassist-3.28.0-GA.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.javassist/javassist/3.28.0-GA/4e112a71eca1bebcadd85c5a07a9a26265eb12f4/javassist-3.28.0-GA-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.github.spotbugs/spotbugs-annotations/3.1.9/2ef5127efcc1a899aab8c66d449a631c9a99c469/spotbugs-annotations-3.1.9.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.github.spotbugs/spotbugs-annotations/3.1.9/6f3558917456604d0d70f416c4a834db8e579843/spotbugs-annotations-3.1.9-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.code.findbugs/jsr305/3.0.2/25ea2e8b0c338a877313bd4672d3fe056ea78f0d/jsr305-3.0.2.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.code.findbugs/jsr305/3.0.2/b19b5927c2c25b6c70f093767041e641ae0b1b35/jsr305-3.0.2-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.mongodb/mongodb-driver-legacy/4.2.2/26df40b6d9e8ccb823c29dcf23ba284e41c9bf16/mongodb-driver-legacy-4.2.2.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.mongodb/mongodb-driver-legacy/4.2.2/e06ebf99b2c3ac1209a60be17522897f45a53c12/mongodb-driver-legacy-4.2.2-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.mongodb/mongodb-driver-sync/4.2.2/701dc782a41912284c21a76b35e96473550fa5cf/mongodb-driver-sync-4.2.2.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.mongodb/mongodb-driver-sync/4.2.2/6be22c59bec7d4de0fbf55909cb6678bbe7d7ad9/mongodb-driver-sync-4.2.2-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.github.classgraph/classgraph/4.8.78/87ced5cc1843e8c1736d9abc4a481e75558edddb/classgraph-4.8.78.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.github.classgraph/classgraph/4.8.78/6f434d8d9a59dd004099ee2daa6d374834361e9f/classgraph-4.8.78-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/net.bytebuddy/byte-buddy/1.11.3/c2a818c3b71127167edff8b9dd1caa946f1c8c49/byte-buddy-1.11.3.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/net.bytebuddy/byte-buddy/1.11.3/fedff48c9c601470f4d31cbc96e16450334b056c/byte-buddy-1.11.3-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/5991ca87ef1fb5544943d9abc5a9a37583fabe03/annotations-13.0-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.mchange/c3p0/0.9.5.4/a21a1d37ae0b59efce99671544f51c34ed1e8def/c3p0-0.9.5.4.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.mchange/c3p0/0.9.5.4/c3bebeb3a803901e8bb0707cb85abe22232fee9a/c3p0-0.9.5.4-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.mchange/mchange-commons-java/0.2.15/6ef5abe5f1b94ac45b7b5bad42d871da4fda6bbc/mchange-commons-java-0.2.15.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.mchange/mchange-commons-java/0.2.15/dbcfc59448950a4899d9ad88f0a916d5f1e420a0/mchange-commons-java-0.2.15-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.mongodb/mongodb-driver-core/4.2.2/1b67153f73a3bcaa94b204cd40543e377ccd7c02/mongodb-driver-core-4.2.2.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.mongodb/mongodb-driver-core/4.2.2/bb57fdf7ab9287c19da557cbfe798b8157e4287f/mongodb-driver-core-4.2.2-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.mongodb/bson/4.2.2/56413d45800ef7391bb038095996f1a659cd8a80/bson-4.2.2.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.mongodb/bson/4.2.2/d6cbe13a51e8871a51e3fe9d74526ac3c8fa6584/bson-4.2.2-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/fastutil-mini-8.5.6.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES/> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/kcp-netty.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES/> - </library> - </orderEntry> - <orderEntry type="module-library" scope="RUNTIME"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-epoll/4.1.71.Final/2241265a918eddaace47d238422950cc17370571/netty-transport-native-epoll-4.1.71.Final-linux-x86_64.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-epoll/4.1.71.Final/f0ae9b17d5bc17bc6068b966517ae150a66d5a2b/netty-transport-native-epoll-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library" scope="RUNTIME"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-epoll/4.1.71.Final/39cbedb9312eae8d9e4622c313f22dfef4106149/netty-transport-native-epoll-4.1.71.Final-linux-aarch_64.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-epoll/4.1.71.Final/f0ae9b17d5bc17bc6068b966517ae150a66d5a2b/netty-transport-native-epoll-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library" scope="RUNTIME"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-kqueue/4.1.71.Final/a7e9bbf9c30db70d5b22ed4c8208b156fcf9cc89/netty-transport-native-kqueue-4.1.71.Final-osx-x86_64.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-kqueue/4.1.71.Final/af5357636d3a98802de915e66be10513cfedfe64/netty-transport-native-kqueue-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library" scope="RUNTIME"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-kqueue/4.1.71.Final/70e613f1023e6118097a6431b5c4608605453679/netty-transport-native-kqueue-4.1.71.Final-osx-aarch_64.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-kqueue/4.1.71.Final/af5357636d3a98802de915e66be10513cfedfe64/netty-transport-native-kqueue-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library" scope="RUNTIME"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver-dns-native-macos/4.1.71.Final/5f43a8f5d1af42d98d1ed69d8c30f77b4a602747/netty-resolver-dns-native-macos-4.1.71.Final-osx-x86_64.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES/> - </library> - </orderEntry> - <orderEntry type="module-library" scope="RUNTIME"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver-dns-native-macos/4.1.71.Final/63c9f402684ed981ff254d9ba16fe2433ba38b7e/netty-resolver-dns-native-macos-4.1.71.Final-osx-aarch_64.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES/> - </library> - </orderEntry> - <orderEntry type="module-library" scope="RUNTIME"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/31.1-jre/60458f877d055d0c9114d9e1a2efb737b4bc282c/guava-31.1-jre.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/31.1-jre/c388a68bc2b17a314dfa7c769d858ada0fc32dcf/guava-31.1-jre-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library" scope="RUNTIME"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/failureaccess/1.0.1/1dcf1de382a0bf95a3d8b0849546c88bac1292c9/failureaccess-1.0.1.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/failureaccess/1.0.1/1d064e61aad6c51cc77f9b59dc2cccc78e792f5a/failureaccess-1.0.1-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library" scope="RUNTIME"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/b421526c5f297295adef1c886e5246c39d4ac629/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES/> - </library> - </orderEntry> - <orderEntry type="module-library" scope="RUNTIME"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.checkerframework/checker-qual/3.12.0/d5692f0526415fcc6de94bb5bfbd3afd9dd3b3e5/checker-qual-3.12.0.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.checkerframework/checker-qual/3.12.0/10dacb8b36398debceca36cd0db5f3316967f80e/checker-qual-3.12.0-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library" scope="RUNTIME"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.errorprone/error_prone_annotations/2.11.0/c5a0ace696d3f8b1c1d8cc036d8c03cc0cbe6b69/error_prone_annotations-2.11.0.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.errorprone/error_prone_annotations/2.11.0/d060e42b6aa896a3abe2ec612e1cf8cc307f8a49/error_prone_annotations-2.11.0-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library" scope="RUNTIME"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.j2objc/j2objc-annotations/1.3/ba035118bc8bac37d7eff77700720999acd9986d/j2objc-annotations-1.3.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.j2objc/j2objc-annotations/1.3/d26c56180205cbb50447c3eca98ecb617cf9f58b/j2objc-annotations-1.3-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library" scope="TEST"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-epoll/4.1.71.Final/2241265a918eddaace47d238422950cc17370571/netty-transport-native-epoll-4.1.71.Final-linux-x86_64.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-epoll/4.1.71.Final/f0ae9b17d5bc17bc6068b966517ae150a66d5a2b/netty-transport-native-epoll-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library" scope="TEST"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-epoll/4.1.71.Final/39cbedb9312eae8d9e4622c313f22dfef4106149/netty-transport-native-epoll-4.1.71.Final-linux-aarch_64.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-epoll/4.1.71.Final/f0ae9b17d5bc17bc6068b966517ae150a66d5a2b/netty-transport-native-epoll-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library" scope="TEST"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-kqueue/4.1.71.Final/a7e9bbf9c30db70d5b22ed4c8208b156fcf9cc89/netty-transport-native-kqueue-4.1.71.Final-osx-x86_64.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-kqueue/4.1.71.Final/af5357636d3a98802de915e66be10513cfedfe64/netty-transport-native-kqueue-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library" scope="TEST"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-kqueue/4.1.71.Final/70e613f1023e6118097a6431b5c4608605453679/netty-transport-native-kqueue-4.1.71.Final-osx-aarch_64.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-kqueue/4.1.71.Final/af5357636d3a98802de915e66be10513cfedfe64/netty-transport-native-kqueue-4.1.71.Final-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library" scope="TEST"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver-dns-native-macos/4.1.71.Final/5f43a8f5d1af42d98d1ed69d8c30f77b4a602747/netty-resolver-dns-native-macos-4.1.71.Final-osx-x86_64.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES/> - </library> - </orderEntry> - <orderEntry type="module-library" scope="TEST"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver-dns-native-macos/4.1.71.Final/63c9f402684ed981ff254d9ba16fe2433ba38b7e/netty-resolver-dns-native-macos-4.1.71.Final-osx-aarch_64.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES/> - </library> - </orderEntry> - <orderEntry type="module-library" scope="TEST"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/31.1-jre/60458f877d055d0c9114d9e1a2efb737b4bc282c/guava-31.1-jre.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/31.1-jre/c388a68bc2b17a314dfa7c769d858ada0fc32dcf/guava-31.1-jre-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library" scope="TEST"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/failureaccess/1.0.1/1dcf1de382a0bf95a3d8b0849546c88bac1292c9/failureaccess-1.0.1.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/failureaccess/1.0.1/1d064e61aad6c51cc77f9b59dc2cccc78e792f5a/failureaccess-1.0.1-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library" scope="TEST"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/b421526c5f297295adef1c886e5246c39d4ac629/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES/> - </library> - </orderEntry> - <orderEntry type="module-library" scope="TEST"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.checkerframework/checker-qual/3.12.0/d5692f0526415fcc6de94bb5bfbd3afd9dd3b3e5/checker-qual-3.12.0.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/org.checkerframework/checker-qual/3.12.0/10dacb8b36398debceca36cd0db5f3316967f80e/checker-qual-3.12.0-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library" scope="TEST"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.errorprone/error_prone_annotations/2.11.0/c5a0ace696d3f8b1c1d8cc036d8c03cc0cbe6b69/error_prone_annotations-2.11.0.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.errorprone/error_prone_annotations/2.11.0/d060e42b6aa896a3abe2ec612e1cf8cc307f8a49/error_prone_annotations-2.11.0-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library" scope="TEST"> - <library> - <CLASSES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.j2objc/j2objc-annotations/1.3/ba035118bc8bac37d7eff77700720999acd9986d/j2objc-annotations-1.3.jar!/"/> - </CLASSES> - <JAVADOC/> - <SOURCES> - <root url="jar://C:/Users/kobed/.gradle/caches/modules-2/files-2.1/com.google.j2objc/j2objc-annotations/1.3/d26c56180205cbb50447c3eca98ecb617cf9f58b/j2objc-annotations-1.3-sources.jar!/"/> - </SOURCES> - </library> - </orderEntry> - </component> - <component name="ModuleRootManager"/> -</module> diff --git a/Grasscutter.ipr b/Grasscutter.ipr deleted file mode 100644 index 3759484a6..000000000 --- a/Grasscutter.ipr +++ /dev/null @@ -1,104 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="CompilerConfiguration"> - <option name="DEFAULT_COMPILER" value="Javac"/> - <resourceExtensions> - <entry name=".+\.(properties|xml|html|dtd|tld)"/> - <entry name=".+\.(gif|png|jpeg|jpg)"/> - </resourceExtensions> - <wildcardResourcePatterns> - <entry name="!?*.class"/> - <entry name="!?*.scala"/> - <entry name="!?*.groovy"/> - <entry name="!?*.java"/> - </wildcardResourcePatterns> - <annotationProcessing enabled="false" useClasspath="true"/> - <bytecodeTargetLevel target="17"/> - </component> - <component name="CopyrightManager" default=""> - <module2copyright/> - </component> - <component name="DependencyValidationManager"> - <option name="SKIP_IMPORT_STATEMENTS" value="false"/> - </component> - <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false"/> - <component name="GradleUISettings"> - <setting name="root"/> - </component> - <component name="GradleUISettings2"> - <setting name="root"/> - </component> - <component name="IdProvider" IDEtalkID="11DA1DB66DD62DDA1ED602B7079FE97C"/> - <component name="JavadocGenerationManager"> - <option name="OUTPUT_DIRECTORY"/> - <option name="OPTION_SCOPE" value="protected"/> - <option name="OPTION_HIERARCHY" value="true"/> - <option name="OPTION_NAVIGATOR" value="true"/> - <option name="OPTION_INDEX" value="true"/> - <option name="OPTION_SEPARATE_INDEX" value="true"/> - <option name="OPTION_DOCUMENT_TAG_USE" value="false"/> - <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false"/> - <option name="OPTION_DOCUMENT_TAG_VERSION" value="false"/> - <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true"/> - <option name="OPTION_DEPRECATED_LIST" value="true"/> - <option name="OTHER_OPTIONS" value=""/> - <option name="HEAP_SIZE"/> - <option name="LOCALE"/> - <option name="OPEN_IN_BROWSER" value="true"/> - </component> - <component name="ProjectModuleManager"> - <modules> - <module fileurl="file://$PROJECT_DIR$/Grasscutter.iml" filepath="$PROJECT_DIR$/Grasscutter.iml"/> - </modules> - </component> - <component name="ProjectRootManager" version="2" languageLevel="JDK_17" assert-keyword="true" jdk-15="true" project-jdk-type="JavaSDK" assert-jdk-15="true" project-jdk-name="17"> - <output url="file://$PROJECT_DIR$/out"/> - </component> - <component name="SvnBranchConfigurationManager"> - <option name="mySupportsUserInfoFilter" value="true"/> - </component> - <component name="VcsDirectoryMappings"> - <mapping directory="" vcs=""/> - </component> - <component name="masterDetails"> - <states> - <state key="ArtifactsStructureConfigurable.UI"> - <UIState> - <splitter-proportions> - <SplitterProportionsDataImpl/> - </splitter-proportions> - <settings/> - </UIState> - </state> - <state key="Copyright.UI"> - <UIState> - <splitter-proportions> - <SplitterProportionsDataImpl/> - </splitter-proportions> - </UIState> - </state> - <state key="ProjectJDKs.UI"> - <UIState> - <splitter-proportions> - <SplitterProportionsDataImpl> - <option name="proportions"> - <list> - <option value="0.2"/> - </list> - </option> - </SplitterProportionsDataImpl> - </splitter-proportions> - <last-edited>1.6</last-edited> - </UIState> - </state> - <state key="ScopeChooserConfigurable.UI"> - <UIState> - <splitter-proportions> - <SplitterProportionsDataImpl/> - </splitter-proportions> - <settings/> - </UIState> - </state> - </states> - </component> -</project> diff --git a/Grasscutter.iws b/Grasscutter.iws deleted file mode 100644 index d5bc7591f..000000000 --- a/Grasscutter.iws +++ /dev/null @@ -1,207 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="ChangeListManager"> - <option name="TRACKING_ENABLED" value="true"/> - <option name="SHOW_DIALOG" value="false"/> - <option name="HIGHLIGHT_CONFLICTS" value="true"/> - <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false"/> - <option name="LAST_RESOLUTION" value="IGNORE"/> - </component> - <component name="ChangesViewManager" flattened_view="true" show_ignored="false"/> - <component name="CreatePatchCommitExecutor"> - <option name="PATCH_PATH" value=""/> - <option name="REVERSE_PATCH" value="false"/> - </component> - <component name="DaemonCodeAnalyzer"> - <disable_hints/> - </component> - <component name="DebuggerManager"> - <breakpoint_any> - <breakpoint> - <option name="NOTIFY_CAUGHT" value="true"/> - <option name="NOTIFY_UNCAUGHT" value="true"/> - <option name="ENABLED" value="false"/> - <option name="LOG_ENABLED" value="false"/> - <option name="LOG_EXPRESSION_ENABLED" value="false"/> - <option name="SUSPEND_POLICY" value="SuspendAll"/> - <option name="COUNT_FILTER_ENABLED" value="false"/> - <option name="COUNT_FILTER" value="0"/> - <option name="CONDITION_ENABLED" value="false"/> - <option name="CLASS_FILTERS_ENABLED" value="false"/> - <option name="INSTANCE_FILTERS_ENABLED" value="false"/> - <option name="CONDITION" value=""/> - <option name="LOG_MESSAGE" value=""/> - </breakpoint> - <breakpoint> - <option name="NOTIFY_CAUGHT" value="true"/> - <option name="NOTIFY_UNCAUGHT" value="true"/> - <option name="ENABLED" value="false"/> - <option name="LOG_ENABLED" value="false"/> - <option name="LOG_EXPRESSION_ENABLED" value="false"/> - <option name="SUSPEND_POLICY" value="SuspendAll"/> - <option name="COUNT_FILTER_ENABLED" value="false"/> - <option name="COUNT_FILTER" value="0"/> - <option name="CONDITION_ENABLED" value="false"/> - <option name="CLASS_FILTERS_ENABLED" value="false"/> - <option name="INSTANCE_FILTERS_ENABLED" value="false"/> - <option name="CONDITION" value=""/> - <option name="LOG_MESSAGE" value=""/> - </breakpoint> - </breakpoint_any> - <breakpoint_rules/> - <ui_properties/> - </component> - <component name="ModuleEditorState"> - <option name="LAST_EDITED_MODULE_NAME"/> - <option name="LAST_EDITED_TAB_NAME"/> - </component> - <component name="ProjectInspectionProfilesVisibleTreeState"> - <entry key="Project Default"> - <profile-state/> - </entry> - </component> - <component name="ProjectLevelVcsManager"> - <OptionsSetting value="true" id="Add"/> - <OptionsSetting value="true" id="Remove"/> - <OptionsSetting value="true" id="Checkout"/> - <OptionsSetting value="true" id="Update"/> - <OptionsSetting value="true" id="Status"/> - <OptionsSetting value="true" id="Edit"/> - <ConfirmationsSetting value="0" id="Add"/> - <ConfirmationsSetting value="0" id="Remove"/> - </component> - <component name="ProjectReloadState"> - <option name="STATE" value="0"/> - </component> - <component name="PropertiesComponent"> - <property name="GoToFile.includeJavaFiles" value="false"/> - <property name="GoToClass.toSaveIncludeLibraries" value="false"/> - <property name="MemberChooser.sorted" value="false"/> - <property name="MemberChooser.showClasses" value="true"/> - <property name="GoToClass.includeLibraries" value="false"/> - <property name="MemberChooser.copyJavadoc" value="false"/> - </component> - <component name="RunManager"> - <configuration default="true" type="Remote" factoryName="Remote"> - <option name="USE_SOCKET_TRANSPORT" value="true"/> - <option name="SERVER_MODE" value="false"/> - <option name="SHMEM_ADDRESS" value="javadebug"/> - <option name="HOST" value="localhost"/> - <option name="PORT" value="5005"/> - <method> - <option name="BuildArtifacts" enabled="false"/> - </method> - </configuration> - <configuration default="true" type="Applet" factoryName="Applet"> - <module name=""/> - <option name="MAIN_CLASS_NAME"/> - <option name="HTML_FILE_NAME"/> - <option name="HTML_USED" value="false"/> - <option name="WIDTH" value="400"/> - <option name="HEIGHT" value="300"/> - <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy"/> - <option name="VM_PARAMETERS"/> - <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false"/> - <option name="ALTERNATIVE_JRE_PATH"/> - <method> - <option name="BuildArtifacts" enabled="false"/> - <option name="Make" enabled="true"/> - </method> - </configuration> - <configuration default="true" type="Application" factoryName="Application"> - <extension name="coverage" enabled="false" merge="false"/> - <option name="MAIN_CLASS_NAME"/> - <option name="VM_PARAMETERS"/> - <option name="PROGRAM_PARAMETERS"/> - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$"/> - <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false"/> - <option name="ALTERNATIVE_JRE_PATH"/> - <option name="ENABLE_SWING_INSPECTOR" value="false"/> - <option name="ENV_VARIABLES"/> - <option name="PASS_PARENT_ENVS" value="true"/> - <module name=""/> - <envs/> - <method> - <option name="BuildArtifacts" enabled="false"/> - <option name="Make" enabled="true"/> - </method> - </configuration> - <configuration default="true" type="JUnit" factoryName="JUnit"> - <extension name="coverage" enabled="false" merge="false"/> - <module name=""/> - <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false"/> - <option name="ALTERNATIVE_JRE_PATH"/> - <option name="PACKAGE_NAME"/> - <option name="MAIN_CLASS_NAME"/> - <option name="METHOD_NAME"/> - <option name="TEST_OBJECT" value="class"/> - <option name="VM_PARAMETERS"/> - <option name="PARAMETERS"/> - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$"/> - <option name="ENV_VARIABLES"/> - <option name="PASS_PARENT_ENVS" value="true"/> - <option name="TEST_SEARCH_SCOPE"> - <value defaultName="moduleWithDependencies"/> - </option> - <envs/> - <method> - <option name="BuildArtifacts" enabled="false"/> - <option name="Make" enabled="true"/> - </method> - </configuration> - <list size="0"/> - <configuration name="<template>" type="WebApp" default="true" selected="false"> - <Host>localhost</Host> - <Port>5050</Port> - </configuration> - </component> - <component name="ShelveChangesManager" show_recycled="false"/> - <component name="SvnConfiguration" maxAnnotateRevisions="500"> - <option name="USER" value=""/> - <option name="PASSWORD" value=""/> - <option name="LAST_MERGED_REVISION"/> - <option name="UPDATE_RUN_STATUS" value="false"/> - <option name="MERGE_DRY_RUN" value="false"/> - <option name="MERGE_DIFF_USE_ANCESTRY" value="true"/> - <option name="UPDATE_LOCK_ON_DEMAND" value="false"/> - <option name="IGNORE_SPACES_IN_MERGE" value="false"/> - <option name="DETECT_NESTED_COPIES" value="true"/> - <option name="IGNORE_SPACES_IN_ANNOTATE" value="true"/> - <option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true"/> - <myIsUseDefaultProxy>false</myIsUseDefaultProxy> - </component> - <component name="TaskManager"> - <task active="true" id="Default" summary="Default task"/> - <servers/> - </component> - <component name="VcsManagerConfiguration"> - <option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true"/> - <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true"/> - <option name="PERFORM_UPDATE_IN_BACKGROUND" value="true"/> - <option name="PERFORM_COMMIT_IN_BACKGROUND" value="true"/> - <option name="PERFORM_EDIT_IN_BACKGROUND" value="true"/> - <option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true"/> - <option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true"/> - <option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false"/> - <option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false"/> - <option name="ENABLE_BACKGROUND_PROCESSES" value="false"/> - <option name="CHANGED_ON_SERVER_INTERVAL" value="60"/> - <option name="FORCE_NON_EMPTY_COMMENT" value="false"/> - <option name="LAST_COMMIT_MESSAGE"/> - <option name="MAKE_NEW_CHANGELIST_ACTIVE" value="true"/> - <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false"/> - <option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false"/> - <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false"/> - <option name="REFORMAT_BEFORE_FILE_COMMIT" value="false"/> - <option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8"/> - <option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5"/> - <option name="ACTIVE_VCS_NAME"/> - <option name="UPDATE_GROUP_BY_PACKAGES" value="false"/> - <option name="UPDATE_GROUP_BY_CHANGELIST" value="false"/> - <option name="SHOW_FILE_HISTORY_AS_TREE" value="false"/> - <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6"/> - </component> - <component name="XDebuggerManager"> - <breakpoint-manager/> - </component> -</project> diff --git a/grasscutter-1.0.3-dev.jar.asc b/grasscutter-1.0.3-dev.jar.asc deleted file mode 100644 index 0249d0297..000000000 --- a/grasscutter-1.0.3-dev.jar.asc +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: BCPG v1.68 - -iQGcBAABCgAGBQJicbItAAoJEK1DoRSUkxpGzZgMAJaxuuXmG3V1gFdJLXoKR+6s -moOjwyD8UDfFModX92Thccgox9/j72A1x8sKQfJNDzI5wx51iR2rXw52KE6GhdVI -vSyhnGv6LGOtGtA59i8wnXcEKBD33Qm6B2KFD4ox4JEheMb/wWK3zF09aknLkUVX -43L48E4dF0lAzJ7QWZTTNKCK156Bwa3F8NhVLGGD6tpGahkS8J73Ax6C8uu6zVKf -8dftBpI+0YxPJkbxoPahVZVmFawUjcjPDcRwG5LTO6McVUI9YzczSHdk0FG39ENo -HXvwsK/xnN2Xy8ta+ylu9Eta0zx9mLTZjEjUQ3B8XjTDDVcz11DlvE5L1jJ8Gov+ -XbCM0m+od0hziCwuYg2BOsi13C9vejA5BoCHeejNTy+QiGGhK4QdyxdufxQD1Bo4 -uF8ZmmeC1AMA7m1y4tqIqwA5iJQx4KaB3aKw8np0bYuVVNnw75wpf3NBcQKW/Jf7 -diKjcimqhSkPpJ/ok0ZqITpMTaYhZoXnyUFsm0DIHA== -=5WgW ------END PGP SIGNATURE----- From 6d678557ff0dcfa27b536fb8c146b9ecf0fadf18 Mon Sep 17 00:00:00 2001 From: gentlespoon <github@gentlespoon.com> Date: Fri, 6 May 2022 15:43:51 -0700 Subject: [PATCH 21/39] fix/runningAndDashingStamina --- .../MovementManager/MovementManager.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/emu/grasscutter/game/managers/MovementManager/MovementManager.java b/src/main/java/emu/grasscutter/game/managers/MovementManager/MovementManager.java index ed1645936..18958f355 100644 --- a/src/main/java/emu/grasscutter/game/managers/MovementManager/MovementManager.java +++ b/src/main/java/emu/grasscutter/game/managers/MovementManager/MovementManager.java @@ -268,7 +268,7 @@ public class MovementManager { if (Grasscutter.getConfig().OpenStamina) { boolean moving = isPlayerMoving(); if (moving || (getCurrentStamina() < getMaximumStamina())) { - Grasscutter.getLogger().debug("Player moving: " + moving + ", stamina full: " + (getCurrentStamina() >= getMaximumStamina()) + ", recalculate stamina"); + // Grasscutter.getLogger().debug("Player moving: " + moving + ", stamina full: " + (getCurrentStamina() >= getMaximumStamina()) + ", recalculate stamina"); Consumption consumption = Consumption.None; // TODO: refactor these conditions. @@ -306,14 +306,16 @@ public class MovementManager { } else if (MotionStatesCategorized.get("RUN").contains(currentState)) { // RUN, DASH and WALK // DASH - if (currentState == MotionState.MOTION_DASH) { - if (previousState == MotionState.MOTION_DASH) { + if (currentState == MotionState.MOTION_DASH_BEFORE_SHAKE) { + consumption = Consumption.DASH; + if (previousState == MotionState.MOTION_DASH_BEFORE_SHAKE) { + // only charge once consumption = Consumption.SPRINT; - } else { - // cost more to start dashing - consumption = Consumption.DASH; } } + if (currentState == MotionState.MOTION_DASH) { + consumption = Consumption.SPRINT; + } // RUN if (currentState == MotionState.MOTION_RUN) { consumption = Consumption.RUN; @@ -347,14 +349,13 @@ public class MovementManager { staminaRecoverDelay = 0; } if (consumption.amount > 0) { - if (staminaRecoverDelay < 5) { + if (staminaRecoverDelay < 10) { staminaRecoverDelay++; consumption = Consumption.None; } } int newStamina = updateStamina(cachedSession, consumption.amount); cachedSession.send(new PacketPlayerPropNotify(player, PlayerProperty.PROP_CUR_PERSIST_STAMINA)); - Grasscutter.getLogger().debug(player.getProperty(PlayerProperty.PROP_CUR_PERSIST_STAMINA) + "/" + player.getProperty(PlayerProperty.PROP_MAX_STAMINA) + "\t" + currentState + "\t" + "isMoving: " + isPlayerMoving() + "\t" + consumption + "(" + consumption.amount + ")"); } } From aa292b1fef63357671dca3dccc4e767227bdbe08 Mon Sep 17 00:00:00 2001 From: KingRainbow44 <kobedo11@gmail.com> Date: Fri, 6 May 2022 19:47:30 -0400 Subject: [PATCH 22/39] Update `Utils.java` --- .../java/emu/grasscutter/utils/Utils.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/main/java/emu/grasscutter/utils/Utils.java b/src/main/java/emu/grasscutter/utils/Utils.java index 268cc6f40..a72815f58 100644 --- a/src/main/java/emu/grasscutter/utils/Utils.java +++ b/src/main/java/emu/grasscutter/utils/Utils.java @@ -5,6 +5,8 @@ import java.nio.file.Files; import java.nio.file.StandardCopyOption; import java.time.*; import java.time.temporal.TemporalAdjusters; +import java.util.HashMap; +import java.util.Map; import java.util.Random; import emu.grasscutter.Config; @@ -260,4 +262,41 @@ public final class Utils { Grasscutter.getLogger().warn("Failed to read from input stream."); } return stringBuilder.toString(); } + + /** + * Switch properties from upper case to lower case? + */ + public static Map<String, Object> switchPropertiesUpperLowerCase(Map<String, Object> objMap, Class<?> cls) { + Map<String, Object> map = new HashMap<>(objMap.size()); + for (String key : objMap.keySet()) { + try { + char c = key.charAt(0); + if (c >= 'a' && c <= 'z') { + try { + cls.getDeclaredField(key); + map.put(key, objMap.get(key)); + } catch (NoSuchFieldException e) { + String s1 = String.valueOf(c).toUpperCase(); + String after = key.length() > 1 ? s1 + key.substring(1) : s1; + cls.getDeclaredField(after); + map.put(after, objMap.get(key)); + } + } else if (c >= 'A' && c <= 'Z') { + try { + cls.getDeclaredField(key); + map.put(key, objMap.get(key)); + } catch (NoSuchFieldException e) { + String s1 = String.valueOf(c).toLowerCase(); + String after = key.length() > 1 ? s1 + key.substring(1) : s1; + cls.getDeclaredField(after); + map.put(after, objMap.get(key)); + } + } + } catch (NoSuchFieldException e) { + map.put(key, objMap.get(key)); + } + } + + return map; + } } From 79babcc53e504b0c53957dc032e616b957f0c44c Mon Sep 17 00:00:00 2001 From: Bwly999 <438225686@qq.com> Date: Sat, 7 May 2022 08:00:31 +0800 Subject: [PATCH 23/39] roll back to timer --- src/main/java/emu/grasscutter/server/game/GameServer.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/emu/grasscutter/server/game/GameServer.java b/src/main/java/emu/grasscutter/server/game/GameServer.java index 0135145c0..e6709abf5 100644 --- a/src/main/java/emu/grasscutter/server/game/GameServer.java +++ b/src/main/java/emu/grasscutter/server/game/GameServer.java @@ -205,7 +205,7 @@ public final class GameServer extends KcpServer { @Override public synchronized void start() { // Schedule game loop. - ScheduledExecutorService gameLoop = Executors.newScheduledThreadPool(2); + Timer gameLoop = new Timer(); gameLoop.scheduleAtFixedRate(new TimerTask() { @Override public void run() { @@ -215,7 +215,8 @@ public final class GameServer extends KcpServer { Grasscutter.getLogger().error(Grasscutter.getLanguage().An_error_occurred_during_game_update, e); } } - }, 0L, 1000L, TimeUnit.MILLISECONDS); + }, new Date(), 1000L); + super.start(); } From f1079953c1809789b98c7de9759f9b4f10126e43 Mon Sep 17 00:00:00 2001 From: KingRainbow44 <kobedo11@gmail.com> Date: Fri, 6 May 2022 20:18:50 -0400 Subject: [PATCH 24/39] Rename `en-US` locale --- src/main/resources/languages/en-US.json | 298 ++++++++++++++++++++++++ 1 file changed, 298 insertions(+) create mode 100644 src/main/resources/languages/en-US.json diff --git a/src/main/resources/languages/en-US.json b/src/main/resources/languages/en-US.json new file mode 100644 index 000000000..48ffb5b0b --- /dev/null +++ b/src/main/resources/languages/en-US.json @@ -0,0 +1,298 @@ +{ + "messages": { + "game": { + "port_bind": "Game Server started on port %s", + "connect": "Client connected from %s", + "disconnect": "Client disconnected from %s", + "game_update_error": "An error occurred during game update.", + "command_error": "Command error:" + }, + "dispatch": { + "port_bind": "[Dispatch] Dispatch server started on port %s", + "request": "[Dispatch] Client %s %s request: %s", + "keystore": { + "general_error": "[Dispatch] Error while loading keystore!", + "password_error": "[Dispatch] Unable to load keystore. Trying default keystore password...", + "no_keystore_error": "[Dispatch] No SSL cert found! Falling back to HTTP server.", + "default_password": "[Dispatch] The default keystore password was loaded successfully. Please consider setting the password to 123456 in config.json." + }, + "no_commands_error": "Commands are not supported in dispatch only mode.", + "unhandled_request_error": "[Dispatch] Potential unhandled %s request: %s", + "account": { + "login_attempt": "[Dispatch] Client %s is trying to log in", + "login_success": "[Dispatch] Client %s logged in as %s", + "login_token_attempt": "[Dispatch] Client %s is trying to log in via token", + "login_token_error": "[Dispatch] Client %s failed to log in via token", + "login_token_success": "[Dispatch] Client %s logged in via token as %s", + "combo_token_success": "[Dispatch] Client %s succeed to exchange combo token", + "combo_token_error": "[Dispatch] Client %s failed to exchange combo token", + "account_login_create_success": "[Dispatch] Client %s failed to log in: Account %s created", + "account_login_create_error": "[Dispatch] Client %s failed to log in: Account create failed", + "account_login_exist_error": "[Dispatch] Client %s failed to log in: Account no found", + "account_cache_error": "Game account cache information error", + "session_key_error": "Wrong session key.", + "username_error": "Username not found.", + "username_create_error": "Username not found, create failed." + } + }, + "status": { + "free_software": "Grasscutter is FREE software. If you have paid for this, you may have been scammed. Homepage: https://github.com/Grasscutters/Grasscutter", + "starting": "Starting Grasscutter...", + "shutdown": "Shutting down...", + "done": "Done! For help, type \"help\"", + "error": "An error occurred.", + "welcome": "Welcome to Grasscutter", + "run_mode_error": "Invalid server run mode: %s.", + "run_mode_help": "Server run mode must be 'HYBRID', 'DISPATCH_ONLY', or 'GAME_ONLY'. Unable to start Grasscutter...", + "create_resources": "Creating resources folder...", + "resources_error": "Place a copy of 'BinOutput' and 'ExcelBinOutput' in the resources folder." + } + }, + "commands": { + "generic": { + "not_specified": "No command specified.", + "unknown_command": "Unknown command: %s", + "permission_error": "You do not have permission to run this command.", + "console_execute_error": "This command can only be run from the console.", + "player_execute_error": "Run this command in-game.", + "command_exist_error": "No command found.", + "invalid": { + "amount": "Invalid amount.", + "artifactId": "Invalid artifactId.", + "avatarId": "Invalid avatarId.", + "avatarLevel": "Invalid avatarLevel.", + "entityId": "Invalid entityId.", + "itemId": "Invalid itemId.", + "itemLevel": "Invalid itemLevel.", + "itemRefinement": "Invalid itemRefinement.", + "playerId": "Invalid playerId.", + "uid": "Invalid UID." + } + }, + "execution": { + "uid_error": "Invalid UID.", + "player_exist_error": "Player not found.", + "player_offline_error": "Player is not online.", + "item_id_error": "Invalid item ID.", + "item_player_exist_error": "Invalid item or UID.", + "entity_id_error": "Invalid entity ID.", + "player_exist_offline_error": "Player not found or is not online.", + "argument_error": "Invalid arguments.", + "clear_target": "Target cleared.", + "set_target": "Subsequent commands will target @%s by default.", + "need_target": "This command requires a target UID. Add a <@UID> argument or set a persistent target with /target @UID." + }, + "status": { + "enabled": "Enabled", + "disabled": "Disabled", + "help": "Help", + "success": "Success" + }, + "account": { + "modify": "Modify user accounts", + "invalid": "Invalid UID.", + "exists": "Account already exists.", + "create": "Account created with UID %s.", + "delete": "Account deleted.", + "no_account": "Account not found.", + "command_usage": "Usage: account <create|delete> <username> [uid]" + }, + "broadcast": { + "command_usage": "Usage: broadcast <message>", + "message_sent": "Message sent." + }, + "changescene": { + "usage": "Usage: changescene <sceneId>", + "already_in_scene": "You are already in that scene.", + "success": "Changed to scene %s.", + "exists_error": "The specified scene does not exist." + }, + "clear": { + "command_usage": "Usage: clear <all|wp|art|mat>", + "weapons": "Cleared weapons for %s.", + "artifacts": "Cleared artifacts for %s.", + "materials": "Cleared materials for %s.", + "furniture": "Cleared furniture for %s.", + "displays": "Cleared displays for %s.", + "virtuals": "Cleared virtuals for %s.", + "everything": "Cleared everything for %s." + }, + "coop": { + "usage": "Usage: coop <playerId> <target playerId>", + "success": "Summoned %s to %s's world." + }, + "enter_dungeon": { + "usage": "Usage: enterdungeon <dungeon id>", + "changed": "Changed to dungeon %s", + "not_found_error": "Dungeon does not exist", + "in_dungeon_error": "You are already in that dungeon" + }, + "giveAll": { + "usage": "Usage: giveall [player] [amount]", + "started": "Receiving all items...", + "success": "Successfully gave all items to %s.", + "invalid_amount_or_playerId": "Invalid amount or player ID." + }, + "giveArtifact": { + "usage": "Usage: giveart|gart [player] <artifactId> <mainPropId> [<appendPropId>[,<times>]]... [level]", + "id_error": "Invalid artifact ID.", + "success": "Given %s to %s." + }, + "giveChar": { + "usage": "Usage: givechar <player> <itemId|itemName> [amount]", + "given": "Given %s with level %s to %s.", + "invalid_avatar_id": "Invalid avatar id.", + "invalid_avatar_level": "Invalid avatar level.", + "invalid_avatar_or_player_id": "Invalid avatar or player ID." + }, + "give": { + "usage": "Usage: give <player> <itemId|itemName> [amount] [level]", + "refinement_only_applicable_weapons": "Refinement is only applicable to weapons.", + "refinement_must_between_1_and_5": "Refinement must be between 1 and 5.", + "given": "Given %s of %s to %s.", + "given_with_level_and_refinement": "Given %s with level %s, refinement %s %s times to %s", + "given_level": "Given %s with level %s %s times to %s" + }, + "godmode": { + "success": "Godmode is now %s for %s." + }, + "heal": { + "success": "All characters have been healed." + }, + "kick": { + "player_kick_player": "Player [%s:%s] has kicked player [%s:%s]", + "server_kick_player": "Kicking player [%s:%s]" + }, + "kill": { + "usage": "Usage: killall [playerUid] [sceneId]", + "scene_not_found_in_player_world": "Scene not found in player world", + "kill_monsters_in_scene": "Killing %s monsters in scene %s" + }, + "killCharacter": { + "usage": "Usage: /killcharacter [playerId]", + "success": "Killed %s's current character." + }, + "list": { + "success": "There are %s player(s) online:" + }, + "permission": { + "usage": "Usage: permission <add|remove> <username> <permission>", + "add": "Permission added.", + "has_error": "They already have this permission!", + "remove": "Permission removed.", + "not_have_error": "They don't have this permission!", + "account_error": "The account cannot be found." + }, + "position": { + "success": "Coordinates: %.3f, %.3f, %.3f\nScene id: %d" + }, + "reload": { + "reload_start": "Reloading config.", + "reload_done": "Reload complete." + }, + "resetConst": { + "reset_all": "Reset all avatars' constellations.", + "success": "Constellations for %s have been reset. Please relog to see changes." + }, + "resetShopLimit": { + "usage": "Usage: /resetshop <player id>" + }, + "sendMail": { + "usage": "Usage: give [player] <itemId|itemName> [amount]", + "user_not_exist": "The user with an id of '%s' does not exist", + "start_composition": "Starting composition of message.\nPlease use `/sendmail <title>` to continue.\nYou can use `/sendmail stop` at any time", + "templates": "Mail templates coming soon implemented...", + "invalid_arguments": "Invalid arguments.\nUsage `/sendmail <userId|all|help> [templateId]`", + "send_cancel": "Message sending cancelled", + "send_done": "Message sent to user %s!", + "send_all_done": "Message sent to all users!", + "not_composition_end": "Message composition not at final stage.\nPlease use `/sendmail %s` or `/sendmail stop` to cancel", + "please_use": "Please use `/sendmail %s`", + "set_title": "Message title set as '%s'.\nUse '/sendmail <content>' to continue.", + "set_contents": "Message contents set as '%s'.\nUse '/sendmail <sender>' to continue.", + "set_message_sender": "Message sender set as '%s'.\nUse '/sendmail <itemId|itemName|finish> [amount] [level]' to continue.", + "send": "Attached %s of %s (level %s) to the message.\nContinue adding more items or use `/sendmail finish` to send the message.", + "invalid_arguments_please_use": "Invalid arguments \n Please use `/sendmail %s`", + "title": "<title>", + "message": "<message>", + "sender": "<sender>", + "arguments": "<itemId|itemName|finish> [amount] [level]", + "error": "ERROR: invalid construction stage %s. Check console for stacktrace." + }, + "sendMessage": { + "usage": "Usage: sendmessage <player> <message>", + "success": "Message sent." + }, + "setFetterLevel": { + "usage": "Usage: setfetterlevel <level>", + "range_error": "Fetter level must be between 0 and 10.", + "success": "Fetter level set to %s", + "level_error": "Invalid fetter level." + }, + "setStats": { + "usage_console": "Usage: setstats|stats @<UID> <stat> <value>", + "usage_ingame": "Usage: setstats|stats [@UID] <stat> <value>", + "help_message": "\n\tValues for <stat>: hp | maxhp | def | atk | em | er | crate | cdmg | cdr | heal | heali | shield | defi\n\t(cont.) Elemental DMG Bonus: epyro | ecryo | ehydro | egeo | edendro | eelectro | ephys\n\t(cont.) Elemental RES: respyro | rescryo | reshydro | resgeo | resdendro | reselectro | resphys\n", + "value_error": "Invalid stat value.", + "uid_error": "Invalid UID.", + "player_error": "Player not found or offline.", + "set_self": "%s set to %s.", + "set_for_uid": "%s for %s set to %s.", + "set_max_hp": "MAX HP set to %s." + }, + "setWorldLevel": { + "usage": "Usage: setworldlevel <level>", + "value_error": "World level must be between 0-8", + "success": "World level set to %s.", + "invalid_world_level": "Invalid world level." + }, + "spawn": { + "usage": "Usage: spawn <entityId> [amount] [level(monster only)]", + "success": "Spawned %s of %s." + }, + "stop": { + "success": "Server shutting down..." + }, + "talent": { + "usage_1": "To set talent level: /talent set <talentID> <value>", + "usage_2": "Another way to set talent level: /talent <n or e or q> <value>", + "usage_3": "To get talent ID: /talent getid", + "lower_16": "Invalid talent level. Level should be lower than 16", + "set_id": "Set talent to %s.", + "set_atk": "Set talent Normal ATK to %s.", + "set_e": "Set talent E to %s.", + "set_q": "Set talent Q to %s.", + "invalid_skill_id": "Invalid skill ID.", + "set_this": "Set this talent to %s.", + "invalid_level": "Invalid talent level.", + "normal_attack_id": "Normal Attack ID %s.", + "e_skill_id": "E skill ID %s.", + "q_skill_id": "Q skill ID %s." + }, + "teleportAll": { + "success": "Summoned all players to your location.", + "error": "You only can use this command in MP mode." + }, + "teleport": { + "usage_server": "Usage: /tp @<player id> <x> <y> <z> [scene id]", + "usage": "Usage: /tp [@<player id>] <x> <y> <z> [scene id]", + "specify_player_id": "You must specify a player id.", + "invalid_position": "Invalid position.", + "success": "Teleported %s to %s, %s, %s in scene %s" + }, + "weather": { + "usage": "Usage: weather <weatherId> [climateId]", + "success": "Changed weather to %s with climate %s", + "invalid_id": "Invalid ID." + }, + "drop": { + "command_usage": "Usage: drop <itemId|itemName> [amount]", + "success": "Dropped %s of %s." + }, + "help": { + "usage": "Usage: ", + "aliases": "Aliases: ", + "available_commands": "Available commands: " + } + } +} \ No newline at end of file From c11e83c48fbe9816cd744a46da20bbef9138f555 Mon Sep 17 00:00:00 2001 From: KingRainbow44 <kobedo11@gmail.com> Date: Fri, 6 May 2022 21:04:39 -0400 Subject: [PATCH 25/39] Bug fixes --- .../java/emu/grasscutter/Grasscutter.java | 14 +- .../server/game/GameServerPacketHandler.java | 1 + .../java/emu/grasscutter/tools/Tools.java | 2 - .../java/emu/grasscutter/utils/Language.java | 2 +- src/main/resources/languages/en_US.json | 298 ------------------ 5 files changed, 13 insertions(+), 304 deletions(-) delete mode 100644 src/main/resources/languages/en_US.json diff --git a/src/main/java/emu/grasscutter/Grasscutter.java b/src/main/java/emu/grasscutter/Grasscutter.java index 12f37b0fa..463823ed9 100644 --- a/src/main/java/emu/grasscutter/Grasscutter.java +++ b/src/main/java/emu/grasscutter/Grasscutter.java @@ -70,12 +70,20 @@ public final class Grasscutter { Crypto.loadKeys(); // Load keys from buffers. // Parse arguments. + boolean exitEarly = false; for (String arg : args) { switch (arg.toLowerCase()) { - case "-handbook" -> Tools.createGmHandbook(); - case "-gachamap" -> Tools.createGachaMapping("./gacha-mapping.js"); + case "-handbook" -> { + Tools.createGmHandbook(); exitEarly = true; + } + case "-gachamap" -> { + Tools.createGachaMapping("./gacha-mapping.js"); exitEarly = true; + } } - } + } + + // Exit early if argument sets it. + if(exitEarly) System.exit(0); // Initialize server. Grasscutter.getLogger().info(translate("messages.status.starting")); diff --git a/src/main/java/emu/grasscutter/server/game/GameServerPacketHandler.java b/src/main/java/emu/grasscutter/server/game/GameServerPacketHandler.java index 35303b639..88e7fa17f 100644 --- a/src/main/java/emu/grasscutter/server/game/GameServerPacketHandler.java +++ b/src/main/java/emu/grasscutter/server/game/GameServerPacketHandler.java @@ -14,6 +14,7 @@ import emu.grasscutter.server.game.GameSession.SessionState; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +@SuppressWarnings("unchecked") public class GameServerPacketHandler { private final Int2ObjectMap<PacketHandler> handlers; diff --git a/src/main/java/emu/grasscutter/tools/Tools.java b/src/main/java/emu/grasscutter/tools/Tools.java index 59c264b2b..475649b1f 100644 --- a/src/main/java/emu/grasscutter/tools/Tools.java +++ b/src/main/java/emu/grasscutter/tools/Tools.java @@ -93,7 +93,6 @@ public final class Tools { } Grasscutter.getLogger().info("GM Handbook generated!"); - System.exit(0); } @SuppressWarnings("deprecation") @@ -183,6 +182,5 @@ public final class Tools { } Grasscutter.getLogger().info("Mappings generated!"); - System.exit(0); } } diff --git a/src/main/java/emu/grasscutter/utils/Language.java b/src/main/java/emu/grasscutter/utils/Language.java index c4af257e8..ec56b41d9 100644 --- a/src/main/java/emu/grasscutter/utils/Language.java +++ b/src/main/java/emu/grasscutter/utils/Language.java @@ -40,7 +40,7 @@ public final class Language { @Nullable JsonObject languageData = null; try { - InputStream file = Grasscutter.class.getResourceAsStream("/lang/" + fileName); + InputStream file = Grasscutter.class.getResourceAsStream("/languages/" + fileName); languageData = Grasscutter.getGsonFactory().fromJson(Utils.readFromInputStream(file), JsonObject.class); } catch (Exception exception) { Grasscutter.getLogger().error("Failed to load language file: " + fileName, exception); diff --git a/src/main/resources/languages/en_US.json b/src/main/resources/languages/en_US.json deleted file mode 100644 index 48ffb5b0b..000000000 --- a/src/main/resources/languages/en_US.json +++ /dev/null @@ -1,298 +0,0 @@ -{ - "messages": { - "game": { - "port_bind": "Game Server started on port %s", - "connect": "Client connected from %s", - "disconnect": "Client disconnected from %s", - "game_update_error": "An error occurred during game update.", - "command_error": "Command error:" - }, - "dispatch": { - "port_bind": "[Dispatch] Dispatch server started on port %s", - "request": "[Dispatch] Client %s %s request: %s", - "keystore": { - "general_error": "[Dispatch] Error while loading keystore!", - "password_error": "[Dispatch] Unable to load keystore. Trying default keystore password...", - "no_keystore_error": "[Dispatch] No SSL cert found! Falling back to HTTP server.", - "default_password": "[Dispatch] The default keystore password was loaded successfully. Please consider setting the password to 123456 in config.json." - }, - "no_commands_error": "Commands are not supported in dispatch only mode.", - "unhandled_request_error": "[Dispatch] Potential unhandled %s request: %s", - "account": { - "login_attempt": "[Dispatch] Client %s is trying to log in", - "login_success": "[Dispatch] Client %s logged in as %s", - "login_token_attempt": "[Dispatch] Client %s is trying to log in via token", - "login_token_error": "[Dispatch] Client %s failed to log in via token", - "login_token_success": "[Dispatch] Client %s logged in via token as %s", - "combo_token_success": "[Dispatch] Client %s succeed to exchange combo token", - "combo_token_error": "[Dispatch] Client %s failed to exchange combo token", - "account_login_create_success": "[Dispatch] Client %s failed to log in: Account %s created", - "account_login_create_error": "[Dispatch] Client %s failed to log in: Account create failed", - "account_login_exist_error": "[Dispatch] Client %s failed to log in: Account no found", - "account_cache_error": "Game account cache information error", - "session_key_error": "Wrong session key.", - "username_error": "Username not found.", - "username_create_error": "Username not found, create failed." - } - }, - "status": { - "free_software": "Grasscutter is FREE software. If you have paid for this, you may have been scammed. Homepage: https://github.com/Grasscutters/Grasscutter", - "starting": "Starting Grasscutter...", - "shutdown": "Shutting down...", - "done": "Done! For help, type \"help\"", - "error": "An error occurred.", - "welcome": "Welcome to Grasscutter", - "run_mode_error": "Invalid server run mode: %s.", - "run_mode_help": "Server run mode must be 'HYBRID', 'DISPATCH_ONLY', or 'GAME_ONLY'. Unable to start Grasscutter...", - "create_resources": "Creating resources folder...", - "resources_error": "Place a copy of 'BinOutput' and 'ExcelBinOutput' in the resources folder." - } - }, - "commands": { - "generic": { - "not_specified": "No command specified.", - "unknown_command": "Unknown command: %s", - "permission_error": "You do not have permission to run this command.", - "console_execute_error": "This command can only be run from the console.", - "player_execute_error": "Run this command in-game.", - "command_exist_error": "No command found.", - "invalid": { - "amount": "Invalid amount.", - "artifactId": "Invalid artifactId.", - "avatarId": "Invalid avatarId.", - "avatarLevel": "Invalid avatarLevel.", - "entityId": "Invalid entityId.", - "itemId": "Invalid itemId.", - "itemLevel": "Invalid itemLevel.", - "itemRefinement": "Invalid itemRefinement.", - "playerId": "Invalid playerId.", - "uid": "Invalid UID." - } - }, - "execution": { - "uid_error": "Invalid UID.", - "player_exist_error": "Player not found.", - "player_offline_error": "Player is not online.", - "item_id_error": "Invalid item ID.", - "item_player_exist_error": "Invalid item or UID.", - "entity_id_error": "Invalid entity ID.", - "player_exist_offline_error": "Player not found or is not online.", - "argument_error": "Invalid arguments.", - "clear_target": "Target cleared.", - "set_target": "Subsequent commands will target @%s by default.", - "need_target": "This command requires a target UID. Add a <@UID> argument or set a persistent target with /target @UID." - }, - "status": { - "enabled": "Enabled", - "disabled": "Disabled", - "help": "Help", - "success": "Success" - }, - "account": { - "modify": "Modify user accounts", - "invalid": "Invalid UID.", - "exists": "Account already exists.", - "create": "Account created with UID %s.", - "delete": "Account deleted.", - "no_account": "Account not found.", - "command_usage": "Usage: account <create|delete> <username> [uid]" - }, - "broadcast": { - "command_usage": "Usage: broadcast <message>", - "message_sent": "Message sent." - }, - "changescene": { - "usage": "Usage: changescene <sceneId>", - "already_in_scene": "You are already in that scene.", - "success": "Changed to scene %s.", - "exists_error": "The specified scene does not exist." - }, - "clear": { - "command_usage": "Usage: clear <all|wp|art|mat>", - "weapons": "Cleared weapons for %s.", - "artifacts": "Cleared artifacts for %s.", - "materials": "Cleared materials for %s.", - "furniture": "Cleared furniture for %s.", - "displays": "Cleared displays for %s.", - "virtuals": "Cleared virtuals for %s.", - "everything": "Cleared everything for %s." - }, - "coop": { - "usage": "Usage: coop <playerId> <target playerId>", - "success": "Summoned %s to %s's world." - }, - "enter_dungeon": { - "usage": "Usage: enterdungeon <dungeon id>", - "changed": "Changed to dungeon %s", - "not_found_error": "Dungeon does not exist", - "in_dungeon_error": "You are already in that dungeon" - }, - "giveAll": { - "usage": "Usage: giveall [player] [amount]", - "started": "Receiving all items...", - "success": "Successfully gave all items to %s.", - "invalid_amount_or_playerId": "Invalid amount or player ID." - }, - "giveArtifact": { - "usage": "Usage: giveart|gart [player] <artifactId> <mainPropId> [<appendPropId>[,<times>]]... [level]", - "id_error": "Invalid artifact ID.", - "success": "Given %s to %s." - }, - "giveChar": { - "usage": "Usage: givechar <player> <itemId|itemName> [amount]", - "given": "Given %s with level %s to %s.", - "invalid_avatar_id": "Invalid avatar id.", - "invalid_avatar_level": "Invalid avatar level.", - "invalid_avatar_or_player_id": "Invalid avatar or player ID." - }, - "give": { - "usage": "Usage: give <player> <itemId|itemName> [amount] [level]", - "refinement_only_applicable_weapons": "Refinement is only applicable to weapons.", - "refinement_must_between_1_and_5": "Refinement must be between 1 and 5.", - "given": "Given %s of %s to %s.", - "given_with_level_and_refinement": "Given %s with level %s, refinement %s %s times to %s", - "given_level": "Given %s with level %s %s times to %s" - }, - "godmode": { - "success": "Godmode is now %s for %s." - }, - "heal": { - "success": "All characters have been healed." - }, - "kick": { - "player_kick_player": "Player [%s:%s] has kicked player [%s:%s]", - "server_kick_player": "Kicking player [%s:%s]" - }, - "kill": { - "usage": "Usage: killall [playerUid] [sceneId]", - "scene_not_found_in_player_world": "Scene not found in player world", - "kill_monsters_in_scene": "Killing %s monsters in scene %s" - }, - "killCharacter": { - "usage": "Usage: /killcharacter [playerId]", - "success": "Killed %s's current character." - }, - "list": { - "success": "There are %s player(s) online:" - }, - "permission": { - "usage": "Usage: permission <add|remove> <username> <permission>", - "add": "Permission added.", - "has_error": "They already have this permission!", - "remove": "Permission removed.", - "not_have_error": "They don't have this permission!", - "account_error": "The account cannot be found." - }, - "position": { - "success": "Coordinates: %.3f, %.3f, %.3f\nScene id: %d" - }, - "reload": { - "reload_start": "Reloading config.", - "reload_done": "Reload complete." - }, - "resetConst": { - "reset_all": "Reset all avatars' constellations.", - "success": "Constellations for %s have been reset. Please relog to see changes." - }, - "resetShopLimit": { - "usage": "Usage: /resetshop <player id>" - }, - "sendMail": { - "usage": "Usage: give [player] <itemId|itemName> [amount]", - "user_not_exist": "The user with an id of '%s' does not exist", - "start_composition": "Starting composition of message.\nPlease use `/sendmail <title>` to continue.\nYou can use `/sendmail stop` at any time", - "templates": "Mail templates coming soon implemented...", - "invalid_arguments": "Invalid arguments.\nUsage `/sendmail <userId|all|help> [templateId]`", - "send_cancel": "Message sending cancelled", - "send_done": "Message sent to user %s!", - "send_all_done": "Message sent to all users!", - "not_composition_end": "Message composition not at final stage.\nPlease use `/sendmail %s` or `/sendmail stop` to cancel", - "please_use": "Please use `/sendmail %s`", - "set_title": "Message title set as '%s'.\nUse '/sendmail <content>' to continue.", - "set_contents": "Message contents set as '%s'.\nUse '/sendmail <sender>' to continue.", - "set_message_sender": "Message sender set as '%s'.\nUse '/sendmail <itemId|itemName|finish> [amount] [level]' to continue.", - "send": "Attached %s of %s (level %s) to the message.\nContinue adding more items or use `/sendmail finish` to send the message.", - "invalid_arguments_please_use": "Invalid arguments \n Please use `/sendmail %s`", - "title": "<title>", - "message": "<message>", - "sender": "<sender>", - "arguments": "<itemId|itemName|finish> [amount] [level]", - "error": "ERROR: invalid construction stage %s. Check console for stacktrace." - }, - "sendMessage": { - "usage": "Usage: sendmessage <player> <message>", - "success": "Message sent." - }, - "setFetterLevel": { - "usage": "Usage: setfetterlevel <level>", - "range_error": "Fetter level must be between 0 and 10.", - "success": "Fetter level set to %s", - "level_error": "Invalid fetter level." - }, - "setStats": { - "usage_console": "Usage: setstats|stats @<UID> <stat> <value>", - "usage_ingame": "Usage: setstats|stats [@UID] <stat> <value>", - "help_message": "\n\tValues for <stat>: hp | maxhp | def | atk | em | er | crate | cdmg | cdr | heal | heali | shield | defi\n\t(cont.) Elemental DMG Bonus: epyro | ecryo | ehydro | egeo | edendro | eelectro | ephys\n\t(cont.) Elemental RES: respyro | rescryo | reshydro | resgeo | resdendro | reselectro | resphys\n", - "value_error": "Invalid stat value.", - "uid_error": "Invalid UID.", - "player_error": "Player not found or offline.", - "set_self": "%s set to %s.", - "set_for_uid": "%s for %s set to %s.", - "set_max_hp": "MAX HP set to %s." - }, - "setWorldLevel": { - "usage": "Usage: setworldlevel <level>", - "value_error": "World level must be between 0-8", - "success": "World level set to %s.", - "invalid_world_level": "Invalid world level." - }, - "spawn": { - "usage": "Usage: spawn <entityId> [amount] [level(monster only)]", - "success": "Spawned %s of %s." - }, - "stop": { - "success": "Server shutting down..." - }, - "talent": { - "usage_1": "To set talent level: /talent set <talentID> <value>", - "usage_2": "Another way to set talent level: /talent <n or e or q> <value>", - "usage_3": "To get talent ID: /talent getid", - "lower_16": "Invalid talent level. Level should be lower than 16", - "set_id": "Set talent to %s.", - "set_atk": "Set talent Normal ATK to %s.", - "set_e": "Set talent E to %s.", - "set_q": "Set talent Q to %s.", - "invalid_skill_id": "Invalid skill ID.", - "set_this": "Set this talent to %s.", - "invalid_level": "Invalid talent level.", - "normal_attack_id": "Normal Attack ID %s.", - "e_skill_id": "E skill ID %s.", - "q_skill_id": "Q skill ID %s." - }, - "teleportAll": { - "success": "Summoned all players to your location.", - "error": "You only can use this command in MP mode." - }, - "teleport": { - "usage_server": "Usage: /tp @<player id> <x> <y> <z> [scene id]", - "usage": "Usage: /tp [@<player id>] <x> <y> <z> [scene id]", - "specify_player_id": "You must specify a player id.", - "invalid_position": "Invalid position.", - "success": "Teleported %s to %s, %s, %s in scene %s" - }, - "weather": { - "usage": "Usage: weather <weatherId> [climateId]", - "success": "Changed weather to %s with climate %s", - "invalid_id": "Invalid ID." - }, - "drop": { - "command_usage": "Usage: drop <itemId|itemName> [amount]", - "success": "Dropped %s of %s." - }, - "help": { - "usage": "Usage: ", - "aliases": "Aliases: ", - "available_commands": "Available commands: " - } - } -} \ No newline at end of file From 2c1cc36ceb73c7f803a5b0b9b4cb0b69c69510d8 Mon Sep 17 00:00:00 2001 From: KingRainbow44 <kobedo11@gmail.com> Date: Fri, 6 May 2022 21:20:41 -0400 Subject: [PATCH 26/39] Rename & refactor --- src/main/resources/languages/{en_US.json => en-US.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/languages/{en_US.json => en-US.json} (100%) diff --git a/src/main/resources/languages/en_US.json b/src/main/resources/languages/en-US.json similarity index 100% rename from src/main/resources/languages/en_US.json rename to src/main/resources/languages/en-US.json From 1d6fd52552f58c4414d38d3402e086a432bb849c Mon Sep 17 00:00:00 2001 From: mingjun97 <my@lyric.today> Date: Thu, 5 May 2022 21:56:34 -0700 Subject: [PATCH 27/39] Prompt for user language option for the `Tools` * GM Handbook * Gacha Map --- .../java/emu/grasscutter/tools/Tools.java | 84 +++++++++++++++++-- 1 file changed, 76 insertions(+), 8 deletions(-) diff --git a/src/main/java/emu/grasscutter/tools/Tools.java b/src/main/java/emu/grasscutter/tools/Tools.java index 475649b1f..2081299d3 100644 --- a/src/main/java/emu/grasscutter/tools/Tools.java +++ b/src/main/java/emu/grasscutter/tools/Tools.java @@ -1,10 +1,12 @@ package emu.grasscutter.tools; +import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; +import java.io.FilenameFilter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; @@ -30,13 +32,73 @@ import emu.grasscutter.data.def.SceneData; import emu.grasscutter.utils.Utils; public final class Tools { - - @SuppressWarnings("deprecation") public static void createGmHandbook() throws Exception { + ToolsWithLanguageOption.createGmHandbook(getLanguageOption()); + } + + public static void createGachaMapping(String location) throws Exception { + ToolsWithLanguageOption.createGachaMapping(location, getLanguageOption()); + } + + public static List<String> getAvailableLanguage() throws Exception { + File textMapFolder = new File(Grasscutter.getConfig().RESOURCE_FOLDER + "TextMap"); + List<String> availableLangList = new ArrayList<String>(); + for (String textMapFileName : textMapFolder.list(new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + if (name.startsWith("TextMap") && name.endsWith(".json")){ + return true; + } + return false; + } + })) { + availableLangList.add(textMapFileName.replace("TextMap","").replace(".json","").toLowerCase()); + } + return availableLangList; + } + + public static String getLanguageOption() throws Exception { + List<String> availableLangList = getAvailableLanguage(); + + // Use system out for better format + if (availableLangList.size() == 1) { + return availableLangList.get(0).toUpperCase(); + } + System.out.println("The following languages mappings are available, please select one: [default: EN]"); + String groupedLangList = "> "; + int groupedLangCount = 0; + String input = ""; + for (String availableLanguage: availableLangList){ + groupedLangCount++; + groupedLangList = groupedLangList + "" + availableLanguage + "\t"; + if (groupedLangCount == 6) { + System.out.println(groupedLangList); + groupedLangCount = 0; + groupedLangList = "> "; + } + } + if (groupedLangCount > 0) { + System.out.println(groupedLangList); + } + System.out.print("\nYour choice:[EN]"); + + input = new BufferedReader(new InputStreamReader(System.in)).readLine(); + if (availableLangList.contains(input.toLowerCase())) { + return input.toUpperCase(); + } + Grasscutter.getLogger().info("Invalid option. Will use EN(English) as fallback"); + + return "EN"; + } +} + +final class ToolsWithLanguageOption { + @SuppressWarnings("deprecation") + public static void createGmHandbook(String language) throws Exception { ResourceLoader.loadResources(); Map<Long, String> map; - try (InputStreamReader fileReader = new InputStreamReader(new FileInputStream(Utils.toFilePath(Grasscutter.getConfig().RESOURCE_FOLDER + "TextMap/TextMapEN.json")), StandardCharsets.UTF_8)) { + try (InputStreamReader fileReader = new InputStreamReader(new FileInputStream(Utils.toFilePath(Grasscutter.getConfig().RESOURCE_FOLDER + "TextMap/TextMap"+language+".json")), StandardCharsets.UTF_8)) { map = Grasscutter.getGsonFactory().fromJson(fileReader, new TypeToken<Map<Long, String>>() {}.getType()); } @@ -96,11 +158,11 @@ public final class Tools { } @SuppressWarnings("deprecation") - public static void createGachaMapping(String location) throws Exception { + public static void createGachaMapping(String location, String language) throws Exception { ResourceLoader.loadResources(); Map<Long, String> map; - try (InputStreamReader fileReader = new InputStreamReader(new FileInputStream(Utils.toFilePath(Grasscutter.getConfig().RESOURCE_FOLDER + "TextMap/TextMapEN.json")), StandardCharsets.UTF_8)) { + try (InputStreamReader fileReader = new InputStreamReader(new FileInputStream(Utils.toFilePath(Grasscutter.getConfig().RESOURCE_FOLDER + "TextMap/TextMap"+language+".json")), StandardCharsets.UTF_8)) { map = Grasscutter.getGsonFactory().fromJson(fileReader, new TypeToken<Map<Long, String>>() {}.getType()); } @@ -113,6 +175,9 @@ public final class Tools { list = new ArrayList<>(GameData.getAvatarDataMap().keySet()); Collections.sort(list); + // if the user made choices for language, I assume it's okay to assign his/her selected language to "en-us" + // since it's the fallback language and there will be no difference in the gacha record page. + // The enduser can still modify the `gacha_mappings.js` directly to enable multilingual for the gacha record system. writer.println("mappings = {\"en-us\": {"); // Avatars @@ -140,10 +205,10 @@ public final class Tools { default: color = "blue"; } - + // Got the magic number 4233146695 from manually search in the json file writer.println( "\"" + (avatarID % 1000 + 1000) + "\" : [\"" - + map.get(data.getNameTextMapHash()) + "(Avatar)\", \"" + + map.get(data.getNameTextMapHash()) + "(" + map.get(4233146695L)+ ")\", \"" + color + "\"]"); } @@ -173,9 +238,12 @@ public final class Tools { default: continue; // skip unnecessary entries } + + // Got the magic number 4231343903 from manually search in the json file + writer.println(",\"" + data.getId() + "\" : [\"" + map.get(data.getNameTextMapHash()).replaceAll("\"", "") - + "(Weapon)\",\""+ color + "\"]"); + + "("+ map.get(4231343903L)+")\",\""+ color + "\"]"); } writer.println(",\"200\": \"Standard\", \"301\": \"Avatar Event\", \"302\": \"Weapon event\""); writer.println("}\n}"); From 1ee9cc80bbe4b1d8996e0e78fe2a26b07c429e71 Mon Sep 17 00:00:00 2001 From: mingjun97 <my@lyric.today> Date: Fri, 6 May 2022 01:47:25 -0700 Subject: [PATCH 28/39] Auto fill name of the event from TextMap --- src/main/java/emu/grasscutter/tools/Tools.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/emu/grasscutter/tools/Tools.java b/src/main/java/emu/grasscutter/tools/Tools.java index 2081299d3..3cb1e07c2 100644 --- a/src/main/java/emu/grasscutter/tools/Tools.java +++ b/src/main/java/emu/grasscutter/tools/Tools.java @@ -245,7 +245,7 @@ final class ToolsWithLanguageOption { "\" : [\"" + map.get(data.getNameTextMapHash()).replaceAll("\"", "") + "("+ map.get(4231343903L)+")\",\""+ color + "\"]"); } - writer.println(",\"200\": \"Standard\", \"301\": \"Avatar Event\", \"302\": \"Weapon event\""); + writer.println(",\"200\": \""+map.get(332935371L)+"\", \"301\": \""+ map.get(2272170627L) + "\", \"302\": \""+map.get(2864268523L)+"\""); writer.println("}\n}"); } From 1ed0511cd70fdaf0fb718422943f59f5df551534 Mon Sep 17 00:00:00 2001 From: Magix <kobedo11@gmail.com> Date: Fri, 6 May 2022 21:12:39 -0400 Subject: [PATCH 29/39] Update Tools.java --- src/main/java/emu/grasscutter/tools/Tools.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/emu/grasscutter/tools/Tools.java b/src/main/java/emu/grasscutter/tools/Tools.java index 3cb1e07c2..a2bee91f0 100644 --- a/src/main/java/emu/grasscutter/tools/Tools.java +++ b/src/main/java/emu/grasscutter/tools/Tools.java @@ -80,7 +80,7 @@ public final class Tools { if (groupedLangCount > 0) { System.out.println(groupedLangList); } - System.out.print("\nYour choice:[EN]"); + System.out.print("\nYour choice:[EN] "); input = new BufferedReader(new InputStreamReader(System.in)).readLine(); if (availableLangList.contains(input.toLowerCase())) { From 043c731575f6c01242a8ac9e353db0fd7181e9cf Mon Sep 17 00:00:00 2001 From: KingRainbow44 <kobedo11@gmail.com> Date: Fri, 6 May 2022 21:52:10 -0400 Subject: [PATCH 30/39] Fix for translation errors --- src/main/java/emu/grasscutter/Grasscutter.java | 2 +- .../emu/grasscutter/server/dispatch/DispatchServer.java | 2 +- src/main/java/emu/grasscutter/utils/Language.java | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/emu/grasscutter/Grasscutter.java b/src/main/java/emu/grasscutter/Grasscutter.java index d05939c05..8295cc599 100644 --- a/src/main/java/emu/grasscutter/Grasscutter.java +++ b/src/main/java/emu/grasscutter/Grasscutter.java @@ -93,7 +93,7 @@ public final class Grasscutter { ResourceLoader.loadAll(); ScriptLoader.init(); - // Database + // Initialize database. DatabaseManager.initialize(); // Create server instances. diff --git a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java index 1695e0208..7e4b1655e 100644 --- a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java +++ b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java @@ -334,7 +334,7 @@ public final class DispatchServer { return; } LoginResultJson responseData = new LoginResultJson(); - Grasscutter.getLogger().info(translate("messages.dispatch.account.login_token_attempt")); + Grasscutter.getLogger().info(translate("messages.dispatch.account.login_token_attempt", req.ip())); // Login Account account = DatabaseHelper.getAccountById(requestData.uid); diff --git a/src/main/java/emu/grasscutter/utils/Language.java b/src/main/java/emu/grasscutter/utils/Language.java index ec56b41d9..8acb05cd4 100644 --- a/src/main/java/emu/grasscutter/utils/Language.java +++ b/src/main/java/emu/grasscutter/utils/Language.java @@ -29,7 +29,13 @@ public final class Language { * @return A translated value with arguments substituted. */ public static String translate(String key, Object... args) { - return Grasscutter.getLanguage().get(key).formatted(args); + String translated = Grasscutter.getLanguage().get(key); + try { + return translated.formatted(args); + } catch (Exception exception) { + Grasscutter.getLogger().error("Failed to format string: " + key, exception); + return translated; + } } /** From f894b96edf7ed6f67f7e57b1b36f0b87ea3f8e29 Mon Sep 17 00:00:00 2001 From: Melledy <52122272+Melledy@users.noreply.github.com> Date: Fri, 6 May 2022 19:12:54 -0700 Subject: [PATCH 31/39] Fix crash on login if the player didnt have a TowerManager --- src/main/java/emu/grasscutter/game/player/Player.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/emu/grasscutter/game/player/Player.java b/src/main/java/emu/grasscutter/game/player/Player.java index ce505caa4..1c14ac09a 100644 --- a/src/main/java/emu/grasscutter/game/player/Player.java +++ b/src/main/java/emu/grasscutter/game/player/Player.java @@ -144,6 +144,7 @@ public class Player { this.avatars = new AvatarStorage(this); this.friendsList = new FriendsList(this); this.mailHandler = new MailHandler(this); + this.towerManager = new TowerManager(this); this.pos = new Position(); this.rotation = new Position(); this.properties = new HashMap<>(); @@ -190,7 +191,6 @@ public class Player { this.nickname = "Traveler"; this.signature = ""; this.teamManager = new TeamManager(this); - this.towerManager = new TowerManager(this); this.birthday = new PlayerBirthday(); this.setProperty(PlayerProperty.PROP_PLAYER_LEVEL, 1); this.setProperty(PlayerProperty.PROP_IS_SPRING_AUTO_USE, 1); @@ -1099,9 +1099,6 @@ public class Player { if (this.getProfile().getUid() == 0) { this.getProfile().syncWithCharacter(this); } - if (this.getTowerManager() == null) { - this.towerManager = new TowerManager(this); - } // Check if player object exists in server // TODO - optimize From e31a0c14ec84b7ec1a6bdd9fa2a4ce5642afcb9e Mon Sep 17 00:00:00 2001 From: Melledy <52122272+Melledy@users.noreply.github.com> Date: Fri, 6 May 2022 19:14:01 -0700 Subject: [PATCH 32/39] Add to gacha mappings to gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 05ac741b2..35ee889c5 100644 --- a/.gitignore +++ b/.gitignore @@ -67,4 +67,5 @@ mongod.exe /*.sh language/ languages/ -gacha-mapping.js \ No newline at end of file +gacha-mapping.js +data/gacha_mappings.js From af39613d4f40883ba56fcd4ea81a3838075dfe68 Mon Sep 17 00:00:00 2001 From: Melledy <52122272+Melledy@users.noreply.github.com> Date: Fri, 6 May 2022 19:16:36 -0700 Subject: [PATCH 33/39] Move server profile away from GameConstants --- src/main/java/emu/grasscutter/GameConstants.java | 6 ------ .../packet/send/PacketGetPlayerFriendListRsp.java | 13 +++++++------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/main/java/emu/grasscutter/GameConstants.java b/src/main/java/emu/grasscutter/GameConstants.java index 4bebf9c81..dc07c32e1 100644 --- a/src/main/java/emu/grasscutter/GameConstants.java +++ b/src/main/java/emu/grasscutter/GameConstants.java @@ -11,13 +11,7 @@ public final class GameConstants { public static final int MAX_TEAMS = 4; public static final int MAIN_CHARACTER_MALE = 10000005; public static final int MAIN_CHARACTER_FEMALE = 10000007; - public static final String SERVER_AVATAR_NAME = Grasscutter.getConfig().getGameServerOptions().ServerNickname; - public static final int SERVER_AVATAR_ID = Grasscutter.getConfig().getGameServerOptions().ServerAvatarId; - public static final String SERVER_SIGNATURE = Grasscutter.getConfig().getGameServerOptions().ServerSignature; public static final Position START_POSITION = new Position(2747, 194, -1719); - public static final int SERVER_NAMECARD_ID = Grasscutter.getConfig().getGameServerOptions().ServerNameCardId; - public static final int SERVER_LEVEL = Grasscutter.getConfig().getGameServerOptions().ServerLevel; - public static final int SERVER_WORLD_LEVEL = Grasscutter.getConfig().getGameServerOptions().ServerWorldLevel; public static final int MAX_FRIENDS = 45; public static final int MAX_FRIEND_REQUESTS = 50; diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java index 781faf411..ff373140b 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java @@ -1,6 +1,7 @@ package emu.grasscutter.server.packet.send; import emu.grasscutter.GameConstants; +import emu.grasscutter.Grasscutter; import emu.grasscutter.game.friends.Friendship; import emu.grasscutter.game.player.Player; import emu.grasscutter.net.packet.BasePacket; @@ -18,13 +19,13 @@ public class PacketGetPlayerFriendListRsp extends BasePacket { FriendBrief serverFriend = FriendBrief.newBuilder() .setUid(GameConstants.SERVER_CONSOLE_UID) - .setNickname(GameConstants.SERVER_AVATAR_NAME) - .setLevel(GameConstants.SERVER_LEVEL) - .setProfilePicture(ProfilePicture.newBuilder().setAvatarId(GameConstants.SERVER_AVATAR_ID)) - .setWorldLevel(GameConstants.SERVER_WORLD_LEVEL) - .setSignature(GameConstants.SERVER_SIGNATURE) + .setNickname(Grasscutter.getConfig().getGameServerOptions().ServerNickname) + .setLevel(Grasscutter.getConfig().getGameServerOptions().ServerLevel) + .setProfilePicture(ProfilePicture.newBuilder().setAvatarId(Grasscutter.getConfig().getGameServerOptions().ServerAvatarId)) + .setWorldLevel(Grasscutter.getConfig().getGameServerOptions().ServerWorldLevel) + .setSignature(Grasscutter.getConfig().getGameServerOptions().ServerSignature) .setLastActiveTime((int) (System.currentTimeMillis() / 1000f)) - .setNameCardId(GameConstants.SERVER_NAMECARD_ID) + .setNameCardId(Grasscutter.getConfig().getGameServerOptions().ServerNameCardId) .setOnlineState(FriendOnlineState.FRIEND_ONLINE) .setParam(1) .setIsGameSource(true) From b3c825918dd66c69f5dc47d42b28715dcd9b0161 Mon Sep 17 00:00:00 2001 From: ShigemoriHakura <62388797+ShigemoriHakura@users.noreply.github.com> Date: Sat, 7 May 2022 10:50:13 +0800 Subject: [PATCH 34/39] Add all expedition rewards (#607) * fix achievement proto TakeAchievementRewardReq tells client the achievements achieved or not and it's progress. * add import * Add all AvatarExpedition protos Expedition system has almost done but still has some bug so it will be uploaded later * Add all expedition rewards --- data/ExpeditionReward.json | 960 +++++++++++++++++++++++++++++++++++++ 1 file changed, 960 insertions(+) diff --git a/data/ExpeditionReward.json b/data/ExpeditionReward.json index 90d9378b6..61c720f07 100644 --- a/data/ExpeditionReward.json +++ b/data/ExpeditionReward.json @@ -1,4 +1,724 @@ [ + { + "expId": 101, + "expeditionRewardDataList": [ + { + "hourTime": 4, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 101001, + "minCount": 4, + "maxCount": 5 + }, { + "itemId": 101002, + "minCount": 2, + "maxCount": 3 + } + ] + }, + { + "hourTime": 8, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 101002, + "minCount": 6, + "maxCount": 7 + }, { + "itemId": 101003, + "minCount": 1, + "maxCount": 2 + } + ] + }, + { + "hourTime": 12, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 101002, + "minCount": 6, + "maxCount": 7 + }, { + "itemId": 101003, + "minCount": 2, + "maxCount": 3 + } + ] + }, + { + "hourTime": 20, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 101002, + "minCount": 3, + "maxCount": 4 + }, { + "itemId": 101003, + "minCount": 7, + "maxCount": 8 + } + ] + } + ] + }, + { + "expId": 102, + "expeditionRewardDataList": [ + { + "hourTime": 4, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100061, + "minCount": 1, + "maxCount": 1 + }, { + "itemId": 100064, + "minCount": 1, + "maxCount": 1 + } + ] + }, + { + "hourTime": 8, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100061, + "minCount": 2, + "maxCount": 4 + }, { + "itemId": 100064, + "minCount": 2, + "maxCount": 4 + } + ] + }, + { + "hourTime": 12, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100061, + "minCount": 4, + "maxCount": 6 + }, { + "itemId": 100064, + "minCount": 4, + "maxCount": 6 + } + ] + }, + { + "hourTime": 20, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100061, + "minCount": 8, + "maxCount": 12 + }, { + "itemId": 100064, + "minCount": 8, + "maxCount": 12 + } + ] + } + ] + } + { + "expId": 103, + "expeditionRewardDataList": [ + { + "hourTime": 4, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 101001, + "minCount": 4, + "maxCount": 5 + }, { + "itemId": 101002, + "minCount": 2, + "maxCount": 3 + } + ] + }, + { + "hourTime": 8, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 101002, + "minCount": 6, + "maxCount": 7 + }, { + "itemId": 101003, + "minCount": 1, + "maxCount": 2 + } + ] + }, + { + "hourTime": 12, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 101002, + "minCount": 6, + "maxCount": 7 + }, { + "itemId": 101003, + "minCount": 2, + "maxCount": 3 + } + ] + }, + { + "hourTime": 20, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 101002, + "minCount": 3, + "maxCount": 4 + }, { + "itemId": 101003, + "minCount": 7, + "maxCount": 8 + } + ] + } + ] + }, + { + "expId": 104, + "expeditionRewardDataList": [ + { + "hourTime": 4, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100012, + "minCount": 1, + "maxCount": 1 + }, { + "itemId": 100062, + "minCount": 1, + "maxCount": 1 + } + ] + }, + { + "hourTime": 8, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100012, + "minCount": 2, + "maxCount": 4 + }, { + "itemId": 100062, + "minCount": 2, + "maxCount": 4 + } + ] + }, + { + "hourTime": 12, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100012, + "minCount": 4, + "maxCount": 6 + }, { + "itemId": 100062, + "minCount": 4, + "maxCount": 6 + } + ] + }, + { + "hourTime": 20, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100012, + "minCount": 8, + "maxCount": 12 + }, { + "itemId": 100062, + "minCount": 8, + "maxCount": 12 + } + ] + } + ] + }, + { + "expId": 105, + "expeditionRewardDataList": [ + { + "hourTime": 4, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100014, + "minCount": 1, + "maxCount": 1 + }, { + "itemId": 100013, + "minCount": 1, + "maxCount": 1 + } + ] + }, + { + "hourTime": 8, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100014, + "minCount": 2, + "maxCount": 4 + }, { + "itemId": 100013, + "minCount": 2, + "maxCount": 4 + } + ] + }, + { + "hourTime": 12, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100014, + "minCount": 4, + "maxCount": 6 + }, { + "itemId": 100013, + "minCount": 4, + "maxCount": 6 + } + ] + }, + { + "hourTime": 20, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100014, + "minCount": 8, + "maxCount": 12 + }, { + "itemId": 100013, + "minCount": 8, + "maxCount": 12 + } + ] + } + ] + }, + { + "expId": 106, + "expeditionRewardDataList": [ + { + "hourTime": 4, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 625, + "maxCount": 625 + } + ] + }, + { + "hourTime": 8, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 1575, + "maxCount": 1575 + } + ] + }, + { + "hourTime": 12, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 2500, + "maxCount": 2500 + } + ] + }, + { + "hourTime": 20, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 5000, + "maxCount": 5000 + } + ] + } + ] + }, + { + "expId": 201, + "expeditionRewardDataList": [ + { + "hourTime": 4, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 625, + "maxCount": 625 + } + ] + }, + { + "hourTime": 8, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 1575, + "maxCount": 1575 + } + ] + }, + { + "hourTime": 12, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 2500, + "maxCount": 2500 + } + ] + }, + { + "hourTime": 20, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 5000, + "maxCount": 5000 + } + ] + } + ] + }, + { + "expId": 202, + "expeditionRewardDataList": [ + { + "hourTime": 4, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100026, + "minCount": 1, + "maxCount": 1 + }, { + "itemId": 100063, + "minCount": 1, + "maxCount": 1 + } + ] + }, + { + "hourTime": 8, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100026, + "minCount": 2, + "maxCount": 4 + }, { + "itemId": 100063, + "minCount": 2, + "maxCount": 4 + } + ] + }, + { + "hourTime": 12, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100026, + "minCount": 4, + "maxCount": 6 + }, { + "itemId": 100063, + "minCount": 4, + "maxCount": 6 + } + ] + }, + { + "hourTime": 20, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100026, + "minCount": 8, + "maxCount": 12 + }, { + "itemId": 100063, + "minCount": 8, + "maxCount": 12 + } + ] + } + ] + }, + { + "expId": 203, + "expeditionRewardDataList": [ + { + "hourTime": 4, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 101001, + "minCount": 4, + "maxCount": 5 + }, { + "itemId": 101002, + "minCount": 2, + "maxCount": 3 + } + ] + }, + { + "hourTime": 8, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 101002, + "minCount": 6, + "maxCount": 7 + }, { + "itemId": 101003, + "minCount": 1, + "maxCount": 2 + } + ] + }, + { + "hourTime": 12, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 101002, + "minCount": 6, + "maxCount": 7 + }, { + "itemId": 101003, + "minCount": 2, + "maxCount": 3 + } + ] + }, + { + "hourTime": 20, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 101002, + "minCount": 3, + "maxCount": 4 + }, { + "itemId": 101003, + "minCount": 7, + "maxCount": 8 + } + ] + } + ] + }, + { + "expId": 204, + "expeditionRewardDataList": [ + { + "hourTime": 4, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100014, + "minCount": 1, + "maxCount": 1 + }, { + "itemId": 100013, + "minCount": 1, + "maxCount": 1 + } + ] + }, + { + "hourTime": 8, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100014, + "minCount": 2, + "maxCount": 4 + }, { + "itemId": 100013, + "minCount": 2, + "maxCount": 4 + } + ] + }, + { + "hourTime": 12, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100014, + "minCount": 4, + "maxCount": 6 + }, { + "itemId": 100013, + "minCount": 4, + "maxCount": 6 + } + ] + }, + { + "hourTime": 20, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100014, + "minCount": 8, + "maxCount": 12 + }, { + "itemId": 100013, + "minCount": 8, + "maxCount": 12 + } + ] + } + ] + }, + { + "expId": 205, + "expeditionRewardDataList": [ + { + "hourTime": 4, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 625, + "maxCount": 625 + } + ] + }, + { + "hourTime": 8, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 1575, + "maxCount": 1575 + } + ] + }, + { + "hourTime": 12, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 2500, + "maxCount": 2500 + } + ] + }, + { + "hourTime": 20, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 5000, + "maxCount": 5000 + } + ] + } + ] + }, + { + "expId": 206, + "expeditionRewardDataList": [ + { + "hourTime": 4, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100026, + "minCount": 1, + "maxCount": 1 + }, { + "itemId": 100063, + "minCount": 1, + "maxCount": 1 + } + ] + }, + { + "hourTime": 8, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100026, + "minCount": 2, + "maxCount": 4 + }, { + "itemId": 100063, + "minCount": 2, + "maxCount": 4 + } + ] + }, + { + "hourTime": 12, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100026, + "minCount": 4, + "maxCount": 6 + }, { + "itemId": 100063, + "minCount": 4, + "maxCount": 6 + } + ] + }, + { + "hourTime": 20, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100026, + "minCount": 8, + "maxCount": 12 + }, { + "itemId": 100063, + "minCount": 8, + "maxCount": 12 + } + ] + } + ] + }, { "expId": 301, "expeditionRewardDataList": [ @@ -44,6 +764,181 @@ } ] }, + { + "expId": 302, + "expeditionRewardDataList": [ + { + "hourTime": 4, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100014, + "minCount": 1, + "maxCount": 1 + }, { + "itemId": 101211, + "minCount": 1, + "maxCount": 1 + } + ] + }, + { + "hourTime": 8, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100014, + "minCount": 2, + "maxCount": 4 + }, { + "itemId": 101211, + "minCount": 2, + "maxCount": 4 + } + ] + }, + { + "hourTime": 12, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100014, + "minCount": 4, + "maxCount": 6 + }, { + "itemId": 101211, + "minCount": 4, + "maxCount": 6 + } + ] + }, + { + "hourTime": 20, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100014, + "minCount": 8, + "maxCount": 12 + }, { + "itemId": 101211, + "minCount": 8, + "maxCount": 12 + } + ] + } + ] + }, + { + "expId": 303, + "expeditionRewardDataList": [ + { + "hourTime": 4, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100012, + "minCount": 1, + "maxCount": 1 + }, { + "itemId": 100002, + "minCount": 1, + "maxCount": 1 + } + ] + }, + { + "hourTime": 8, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100012, + "minCount": 2, + "maxCount": 4 + }, { + "itemId": 100002, + "minCount": 2, + "maxCount": 4 + } + ] + }, + { + "hourTime": 12, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100012, + "minCount": 4, + "maxCount": 6 + }, { + "itemId": 100002, + "minCount": 4, + "maxCount": 6 + } + ] + }, + { + "hourTime": 20, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100012, + "minCount": 8, + "maxCount": 12 + }, { + "itemId": 100002, + "minCount": 8, + "maxCount": 12 + } + ] + } + ] + }, + { + "expId": 304, + "expeditionRewardDataList": [ + { + "hourTime": 4, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 625, + "maxCount": 625 + } + ] + }, + { + "hourTime": 8, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 1575, + "maxCount": 1575 + } + ] + }, + { + "hourTime": 12, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 2500, + "maxCount": 2500 + } + ] + }, + { + "hourTime": 20, + "expeditionRewardData": [ + { + "itemId": 202, + "minCount": 5000, + "maxCount": 5000 + } + ] + } + ] + }, { "expId": 305, "expeditionRewardDataList": [ @@ -108,5 +1003,70 @@ ] } ] + }, + { + "expId": 306, + "expeditionRewardDataList": [ + { + "hourTime": 4, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100061, + "minCount": 1, + "maxCount": 1 + }, { + "itemId": 100062, + "minCount": 1, + "maxCount": 1 + } + ] + }, + { + "hourTime": 8, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100061, + "minCount": 2, + "maxCount": 4 + }, { + "itemId": 100062, + "minCount": 2, + "maxCount": 4 + } + ] + }, + { + "hourTime": 12, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100061, + "minCount": 4, + "maxCount": 6 + }, { + "itemId": 100062, + "minCount": 4, + "maxCount": 6 + } + ] + }, + { + "hourTime": 20, + "rewardMora": 0, + "expeditionRewardData": [ + { + "itemId": 100061, + "minCount": 8, + "maxCount": 12 + }, { + "itemId": 100062, + "minCount": 8, + "maxCount": 12 + } + ] + } + ] } ] \ No newline at end of file From 557e641fca8792fa4f84f0c4c20540af8edac7c8 Mon Sep 17 00:00:00 2001 From: Melledy <52122272+Melledy@users.noreply.github.com> Date: Fri, 6 May 2022 20:04:25 -0700 Subject: [PATCH 35/39] Fix missing comma in expedition reward's json --- data/ExpeditionReward.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/ExpeditionReward.json b/data/ExpeditionReward.json index 61c720f07..b7c5db45d 100644 --- a/data/ExpeditionReward.json +++ b/data/ExpeditionReward.json @@ -128,7 +128,7 @@ ] } ] - } + }, { "expId": 103, "expeditionRewardDataList": [ From 0690e23116066957d8de94f4cf6896b545596178 Mon Sep 17 00:00:00 2001 From: lhhxxxxx <91231470+lhhxxxxx@users.noreply.github.com> Date: Sat, 7 May 2022 12:20:44 +0800 Subject: [PATCH 36/39] Handle with undetermined locale language config (#611) * Update GiveAllCommand.java giveall command nomore give arts * Update Grasscutter.java * Update Grasscutter.java --- src/main/java/emu/grasscutter/Grasscutter.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/emu/grasscutter/Grasscutter.java b/src/main/java/emu/grasscutter/Grasscutter.java index 823633c4f..89c4d8a26 100644 --- a/src/main/java/emu/grasscutter/Grasscutter.java +++ b/src/main/java/emu/grasscutter/Grasscutter.java @@ -149,7 +149,13 @@ public final class Grasscutter { public static void loadLanguage() { var locale = config.LocaleLanguage; - language = Language.getLanguage(locale.toLanguageTag()); + String languageTag = locale.toLanguageTag(); + if (languageTag.equals("und")) { + Grasscutter.getLogger().error("Illegal locale language, using en-US instead."); + language = Language.getLanguage("en-US"); + } else { + language = Language.getLanguage(languageTag); + } } public static void saveConfig() { From a9a027bbc6a423caddffada02759eb5219688bcd Mon Sep 17 00:00:00 2001 From: FpguDhk <3411015214@qq.com> Date: Sat, 7 May 2022 11:38:14 +0800 Subject: [PATCH 37/39] Fix the Chinese messy code problem. --- src/main/java/emu/grasscutter/utils/Utils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/emu/grasscutter/utils/Utils.java b/src/main/java/emu/grasscutter/utils/Utils.java index a72815f58..259fc8ad5 100644 --- a/src/main/java/emu/grasscutter/utils/Utils.java +++ b/src/main/java/emu/grasscutter/utils/Utils.java @@ -254,7 +254,7 @@ public final class Utils { */ public static String readFromInputStream(InputStream stream) { StringBuilder stringBuilder = new StringBuilder(); - try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) { + try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream,"UTF-8"))) { String line; while ((line = reader.readLine()) != null) { stringBuilder.append(line); } stream.close(); From f9b5478c9de2fb35acce628fead788c81ae6accf Mon Sep 17 00:00:00 2001 From: Secretboy <74841174+Secretboy-SMR@users.noreply.github.com> Date: Sat, 7 May 2022 12:48:53 +0800 Subject: [PATCH 38/39] Update Config.java --- src/main/java/emu/grasscutter/Config.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/emu/grasscutter/Config.java b/src/main/java/emu/grasscutter/Config.java index 93e1480d2..1111ba920 100644 --- a/src/main/java/emu/grasscutter/Config.java +++ b/src/main/java/emu/grasscutter/Config.java @@ -23,6 +23,7 @@ public final class Config { public GameServerOptions GameServer = new GameServerOptions(); public DispatchServerOptions DispatchServer = new DispatchServerOptions(); public Locale LocaleLanguage = Locale.getDefault(); + public Locale DefaultLanguage = Locale.US; public Boolean OpenStamina = true; public GameServerOptions getGameServerOptions() { From bf0d01778eaab4dfcba6b32484c911fc37396b76 Mon Sep 17 00:00:00 2001 From: Secretboy <74841174+Secretboy-SMR@users.noreply.github.com> Date: Sat, 7 May 2022 12:50:10 +0800 Subject: [PATCH 39/39] Update Language.java --- .../java/emu/grasscutter/utils/Language.java | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/src/main/java/emu/grasscutter/utils/Language.java b/src/main/java/emu/grasscutter/utils/Language.java index 8acb05cd4..340d35dc2 100644 --- a/src/main/java/emu/grasscutter/utils/Language.java +++ b/src/main/java/emu/grasscutter/utils/Language.java @@ -39,18 +39,47 @@ public final class Language { } /** - * Reads a file and creates a language instance. + * creates a language instance. * @param fileName The name of the language file. */ private Language(String fileName) { @Nullable JsonObject languageData = null; + + languageData = loadLanguage(fileName); + + if (languageData == null) { + Grasscutter.getLogger().info("Now switch to default language"); + languageData = loadDefaultLanguage(); + } + + assert languageData != null : "languageData is null"; + this.languageData = languageData; + } + + /** + * Load default language file and creates a language instance. + * @return language data + */ + private JsonObject loadDefaultLanguage() { + var fileName = Grasscutter.getConfig().DefaultLanguage.toLanguageTag() + ".json"; + return loadLanguage(fileName); + } + + /** + * Reads a file and creates a language instance. + * @param fileName The name of the language file. + * @return language data + */ + private JsonObject loadLanguage(String fileName) { + @Nullable JsonObject languageData = null; try { InputStream file = Grasscutter.class.getResourceAsStream("/languages/" + fileName); languageData = Grasscutter.getGsonFactory().fromJson(Utils.readFromInputStream(file), JsonObject.class); } catch (Exception exception) { - Grasscutter.getLogger().error("Failed to load language file: " + fileName, exception); - } this.languageData = languageData; + Grasscutter.getLogger().warn("Failed to load language file: " + fileName); + } + return languageData; } /**