Command: Add permissionTargeted or targetRequirement

This commit is contained in:
Tesutarin 2022-06-12 10:44:13 +08:00 committed by Melledy
parent c4ce6caeba
commit c5b45358e7
8 changed files with 18 additions and 15 deletions

View File

@ -7,7 +7,7 @@ import java.lang.annotation.RetentionPolicy;
public @interface Command {
String label() default "";
String usage() default "No usage specified";
String usage() default "commands.generic.no_usage_specified";
String description() default "commands.generic.no_description_specified";

View File

@ -8,7 +8,7 @@ import java.util.List;
import static emu.grasscutter.utils.Language.translate;
@Command(label = "kick", usage = "kick", permission = "server.kick", description = "commands.kick.description")
@Command(label = "kick", usage = "kick", permission = "server.kick", permissionTargeted = "server.kick.others", description = "commands.kick.description")
public final class KickCommand implements CommandHandler {
@Override

View File

@ -10,7 +10,7 @@ import java.util.List;
import static emu.grasscutter.utils.Language.translate;
@Command(label = "permission", usage = "permission <add|remove> <permission>", permission = "permission", description = "commands.permission.description")
@Command(label = "permission", usage = "permission <add|remove> <permission>", permission = "server.permission", description = "commands.permission.description", targetRequirement = Command.TargetRequirement.NONE)
public final class PermissionCommand implements CommandHandler {
@Override

View File

@ -9,7 +9,7 @@ import java.util.List;
import static emu.grasscutter.utils.Language.translate;
@Command(label = "position", usage = "position", aliases = {"pos"}, description = "commands.position.description")
@Command(label = "position", usage = "position", aliases = {"pos"}, description = "commands.position.description", targetRequirement = Command.TargetRequirement.NONE)
public final class PositionCommand implements CommandHandler {
@Override

View File

@ -9,8 +9,8 @@ import java.util.List;
import static emu.grasscutter.utils.Language.translate;
@Command(label = "unlocktower", usage = "unlocktower", aliases = {"ut"},
description = "commands.unlocktower.description", permission = "player.tower")
@Command(label = "unlocktower", usage = "unlocktower", aliases = {"ut"}, permission = "player.unlocktower", permissionTargeted = "player.unlocktower.others",
description = "commands.unlocktower.description")
public class UnlockTowerCommand implements CommandHandler {
@Override

View File

@ -64,7 +64,8 @@
"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.",
"no_description_specified": "No description specified.",
"no_usage_specified": "No usage specified",
"no_description_specified": "No description specified",
"invalid": {
"amount": "Invalid amount.",
"artifactId": "Invalid artifact ID.",
@ -389,7 +390,7 @@
},
"unlocktower": {
"success": "Unlock done.",
"description": "Unlock all levels of tower"
"description": "Unlock Abyss Corridor's Floors"
}
},
"gacha": {

View File

@ -14,7 +14,7 @@
"general_error": "[Dispatch] 加载 keystore 文件时发生错误!",
"password_error": "[Dispatch] 加载 keystore 失败。正在尝试使用 keystore 默认密码...",
"no_keystore_error": "[Dispatch] 未找到 SSL 证书!已降级到 HTTP 模式",
"default_password": "[Dispatch] 成功加载 keystore 默认密码。请考虑将 config.json 中默认密码设置为 123456"
"default_password": "[Dispatch] 成功加载 keystore 默认密码。请考虑将 config.json 中默认密码设置为 123456"
},
"authentication": {
"default_unable_to_verify": "[Authentication] 称为 verifyUser 的方法在默认验证程序中不可用"
@ -64,7 +64,8 @@
"console_execute_error": "此命令只能在控制台执行。",
"player_execute_error": "此命令只能在游戏内执行。",
"command_exist_error": "未找到命令。",
"no_description_specified": "未指定说明。",
"no_usage_specified": "未指定用法",
"no_description_specified": "未指定说明",
"invalid": {
"amount": "无效的数量。",
"artifactId": "无效的圣遗物ID。",
@ -137,7 +138,7 @@
"coop": {
"usage": "用法coop [指定玩家UID]",
"success": "已强制传送 %s 到 %s 的世界。",
"description": "强制传送指定玩家到他人的世界。如果没有指定玩家,则会使你进入多人游戏模式"
"description": "强制传送指定玩家到他人的世界。如果没有指定玩家,则会使你进入多人游戏状态"
},
"enter_dungeon": {
"usage": "用法enterdungeon <秘境ID>",
@ -186,7 +187,7 @@
},
"unlimitenergy": {
"success": "UnlimitEnergy 已设为 %s。[用户:%s]",
"config_error": "命令不可用。因为 config.json 中 energyUsage 为 false",
"config_error": "命令不可用。因为 config.json 中 energyUsage 为 false",
"description": "使用元素爆发而不消耗能量"
},
"heal": {
@ -389,7 +390,7 @@
},
"unlocktower": {
"success": "解锁完成。",
"description": "解锁全部深境螺旋"
"description": "解锁深境回廊(1-8层)"
}
},
"gacha": {

View File

@ -64,7 +64,8 @@
"console_execute_error": "此指令只能在伺服器的命令提示字元執行。",
"player_execute_error": "請在遊戲裡使用這條指令。",
"command_exist_error": "找不到指令。",
"no_description_specified": "没有指定說明。",
"no_usage_specified": "沒有指定用法",
"no_description_specified": "没有指定說明",
"invalid": {
"amount": "無效的數量。",
"artifactId": "無效的聖遺物ID。",
@ -389,7 +390,7 @@
},
"unlocktower": {
"success": "解鎖完成。",
"description": "解鎖所有級別的深境螺旋。"
"description": "解鎖深境迴廊。"
}
},
"gacha": {