diff --git a/src/main/java/emu/grasscutter/command/commands/HelpCommand.java b/src/main/java/emu/grasscutter/command/commands/HelpCommand.java index 431890fda..f4588ef25 100644 --- a/src/main/java/emu/grasscutter/command/commands/HelpCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/HelpCommand.java @@ -46,8 +46,24 @@ public final class HelpCommand implements CommandHandler { builder.append(alias).append(" "); } } + + builder.append("\n").append(translate(player, "commands.help.tip_need_permission")); + if(annotation.permission().isEmpty() || annotation.permission().isBlank()) { + builder.append(translate(player, "commands.help.tip_need_no_permission")); + } + else { + builder.append(annotation.permission()); + } + builder.append(" "); + + if(!annotation.permissionTargeted().isEmpty() && !annotation.permissionTargeted().isBlank()) { + String permissionTargeted = annotation.permissionTargeted(); + builder.append(translate(player, "commands.help.tip_permission_targeted", permissionTargeted)); + } + if (player != null && !Objects.equals(annotation.permission(), "") && !player.getAccount().hasPermission(annotation.permission())) { - builder.append("\n Warning: You do not have permission to run this command."); + builder.append("\n "); + builder.append(translate(player, "commands.help.warn_player_has_no_permission")); } } @@ -68,6 +84,20 @@ public final class HelpCommand implements CommandHandler { builder.append(alias).append(" "); } } + builder.append("\n").append(translate(player, "commands.help.tip_need_permission")); + if(annotation.permission().isEmpty() || annotation.permission().isBlank()) { + builder.append(translate(player, "commands.help.tip_need_no_permission")); + } + else { + builder.append(annotation.permission()); + } + + builder.append(" "); + + if(!annotation.permissionTargeted().isEmpty() && !annotation.permissionTargeted().isBlank()) { + String permissionTargeted = annotation.permissionTargeted(); + builder.append(translate(player, "commands.help.tip_permission_targeted", permissionTargeted)); + } builder.append("\n"); }); @@ -85,6 +115,21 @@ public final class HelpCommand implements CommandHandler { builder.append(alias).append(" "); } } + builder.append("\n").append(translate(player, "commands.help.permission")); + if(annotation.permission().isEmpty() || annotation.permission().isBlank()) { + builder.append(translate(player, "commands.help.no_permission")); + } + else { + builder.append(annotation.permission()); + } + + builder.append(" "); + + if(!annotation.permissionTargeted().isEmpty() && !annotation.permissionTargeted().isBlank()) { + String permissionTargeted = annotation.permissionTargeted(); + builder.append(translate(player, "commands.help.tip_permission_targeted", permissionTargeted)); + } + CommandHandler.sendMessage(player, builder.toString()); }); diff --git a/src/main/resources/languages/en-US.json b/src/main/resources/languages/en-US.json index 2df916487..a057be8cb 100644 --- a/src/main/resources/languages/en-US.json +++ b/src/main/resources/languages/en-US.json @@ -167,7 +167,11 @@ "usage": "Usage: ", "aliases": "Aliases: ", "available_commands": "Available commands: ", - "description": "Sends the help message or shows information about a specified command" + "description": "Sends the help message or shows information about a specified command", + "tip_need_permission": "Permission: ", + "tip_need_no_permission": " None", + "tip_permission_targeted": " (Permission %s is also required to use on other players)", + "warn_player_has_no_permission": "Notice: You do not have permission to run this command." }, "kick": { "player_kick_player": "Player [%s:%s] has kicked player [%s:%s]", diff --git a/src/main/resources/languages/zh-CN.json b/src/main/resources/languages/zh-CN.json index c50f59b73..64fade3d9 100644 --- a/src/main/resources/languages/zh-CN.json +++ b/src/main/resources/languages/zh-CN.json @@ -167,7 +167,12 @@ "usage": "用法:", "aliases": "别名:", "available_commands": "可用命令:", - "description": "发送帮助信息或显示指定命令的信息" + "description": "发送帮助信息或显示指定命令的信息", + "tip_need_permission": "所需权限: ", + "tip_need_no_permission": " 无", + "tip_permission_targeted": "(对其他玩家使用这个命令还需要权限%s)", + "warn_player_has_no_permission": "注意:你没有执行这个命令的权限" + }, "kick": { "player_kick_player": "玩家 [%s:%s] 已将 [%s:%s] 踢出。", diff --git a/src/main/resources/languages/zh-TW.json b/src/main/resources/languages/zh-TW.json index 30e0e9e7f..da4b1e018 100644 --- a/src/main/resources/languages/zh-TW.json +++ b/src/main/resources/languages/zh-TW.json @@ -178,7 +178,11 @@ "usage": "用法:", "aliases": "別名:", "description": "發送幫助信息或顯示特定命令的信息", - "available_commands": "可用指令:" + "available_commands": "可用指令:", + "tip_need_permission": "需要的權限: ", + "tip_need_no_permission": "無", + "tip_permission_targeted": "(對其他的玩家使用這個指令還需要權限%s)", + "warn_player_has_no_permission": "注意:你沒有執行這條指令的權限" }, "kick": { "player_kick_player": "玩家 [%s:%s] 已把 [%s:%s] 踢出",