mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-12-02 00:15:14 +00:00
Added permission information to help command (#1427)
Original commits: * Added command CommandPermissionCommand. Added permission information in HelpCommand. * Removed command CommandPermissionCommand * Display permission for single command when use help. * Display permission targeted when use help.
This commit is contained in:
parent
b974e61165
commit
50f1d909e6
@ -46,8 +46,24 @@ public final class HelpCommand implements CommandHandler {
|
|||||||
builder.append(alias).append(" ");
|
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())) {
|
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(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");
|
builder.append("\n");
|
||||||
});
|
});
|
||||||
@ -85,6 +115,21 @@ public final class HelpCommand implements CommandHandler {
|
|||||||
builder.append(alias).append(" ");
|
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());
|
CommandHandler.sendMessage(player, builder.toString());
|
||||||
});
|
});
|
||||||
|
@ -167,7 +167,11 @@
|
|||||||
"usage": "Usage: ",
|
"usage": "Usage: ",
|
||||||
"aliases": "Aliases: ",
|
"aliases": "Aliases: ",
|
||||||
"available_commands": "Available commands: ",
|
"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": {
|
"kick": {
|
||||||
"player_kick_player": "Player [%s:%s] has kicked player [%s:%s]",
|
"player_kick_player": "Player [%s:%s] has kicked player [%s:%s]",
|
||||||
|
@ -167,7 +167,12 @@
|
|||||||
"usage": "用法:",
|
"usage": "用法:",
|
||||||
"aliases": "别名:",
|
"aliases": "别名:",
|
||||||
"available_commands": "可用命令:",
|
"available_commands": "可用命令:",
|
||||||
"description": "发送帮助信息或显示指定命令的信息"
|
"description": "发送帮助信息或显示指定命令的信息",
|
||||||
|
"tip_need_permission": "所需权限: ",
|
||||||
|
"tip_need_no_permission": " 无",
|
||||||
|
"tip_permission_targeted": "(对其他玩家使用这个命令还需要权限%s)",
|
||||||
|
"warn_player_has_no_permission": "注意:你没有执行这个命令的权限"
|
||||||
|
|
||||||
},
|
},
|
||||||
"kick": {
|
"kick": {
|
||||||
"player_kick_player": "玩家 [%s:%s] 已将 [%s:%s] 踢出。",
|
"player_kick_player": "玩家 [%s:%s] 已将 [%s:%s] 踢出。",
|
||||||
|
@ -178,7 +178,11 @@
|
|||||||
"usage": "用法:",
|
"usage": "用法:",
|
||||||
"aliases": "別名:",
|
"aliases": "別名:",
|
||||||
"description": "發送幫助信息或顯示特定命令的信息",
|
"description": "發送幫助信息或顯示特定命令的信息",
|
||||||
"available_commands": "可用指令:"
|
"available_commands": "可用指令:",
|
||||||
|
"tip_need_permission": "需要的權限: ",
|
||||||
|
"tip_need_no_permission": "無",
|
||||||
|
"tip_permission_targeted": "(對其他的玩家使用這個指令還需要權限%s)",
|
||||||
|
"warn_player_has_no_permission": "注意:你沒有執行這條指令的權限"
|
||||||
},
|
},
|
||||||
"kick": {
|
"kick": {
|
||||||
"player_kick_player": "玩家 [%s:%s] 已把 [%s:%s] 踢出",
|
"player_kick_player": "玩家 [%s:%s] 已把 [%s:%s] 踢出",
|
||||||
|
Loading…
Reference in New Issue
Block a user