From 7157a27fa9d454f3f9c6915ae434534cbef7fa5b Mon Sep 17 00:00:00 2001 From: zhangyuheng Date: Mon, 26 Aug 2024 09:31:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E9=83=A8=E5=88=86=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/DominionController.java | 6 +++ .../dominion/controllers/GroupController.java | 49 +++++++++++++++++++ .../controllers/TemplateController.java | 20 ++++++++ 3 files changed, 75 insertions(+) diff --git a/core/src/main/java/cn/lunadeer/dominion/controllers/DominionController.java b/core/src/main/java/cn/lunadeer/dominion/controllers/DominionController.java index d8744df6..cabad38e 100644 --- a/core/src/main/java/cn/lunadeer/dominion/controllers/DominionController.java +++ b/core/src/main/java/cn/lunadeer/dominion/controllers/DominionController.java @@ -25,6 +25,12 @@ public class DominionController { + /** + * 获取玩家拥有的领地 + * + * @param owner 玩家 + * @return 领地列表 + */ public static List all(Player owner) { return DominionDTO.selectByOwner(owner.getUniqueId()); } diff --git a/core/src/main/java/cn/lunadeer/dominion/controllers/GroupController.java b/core/src/main/java/cn/lunadeer/dominion/controllers/GroupController.java index e523ec05..25abaf8c 100644 --- a/core/src/main/java/cn/lunadeer/dominion/controllers/GroupController.java +++ b/core/src/main/java/cn/lunadeer/dominion/controllers/GroupController.java @@ -9,6 +9,14 @@ public class GroupController { + /** + * 创建权限组 + * + * @param operator 操作者 + * @param domName 领地名称 + * @param groupName 权限组名称 + * @param nameColored 权限组名称(带颜色) + */ public static void createGroup(AbstractOperator operator, String domName, String groupName, String nameColored) { AbstractOperator.Result FAIL = new AbstractOperator.Result(AbstractOperator.Result.FAILURE, "创建权限组 %s 失败", groupName); AbstractOperator.Result SUCCESS = new AbstractOperator.Result(AbstractOperator.Result.SUCCESS, "创建权限组 %s 成功", groupName); @@ -38,6 +46,13 @@ public static void createGroup(AbstractOperator operator, String domName, String operator.setResponse(SUCCESS); } + /** + * 删除权限组 + * + * @param operator 操作者 + * @param domName 领地名称 + * @param groupName 权限组名称 + */ public static void deleteGroup(AbstractOperator operator, String domName, String groupName) { AbstractOperator.Result FAIL = new AbstractOperator.Result(AbstractOperator.Result.FAILURE, "删除权限组 %s 失败", groupName); AbstractOperator.Result SUCCESS = new AbstractOperator.Result(AbstractOperator.Result.SUCCESS, "删除权限组 %s 成功", groupName); @@ -59,6 +74,15 @@ public static void deleteGroup(AbstractOperator operator, String domName, String operator.setResponse(SUCCESS); } + /** + * 设置权限组权限 + * + * @param operator 操作者 + * @param domName 领地名称 + * @param groupName 权限组名称 + * @param flag 权限名称 + * @param value 权限值 + */ public static void setGroupFlag(AbstractOperator operator, String domName, String groupName, String flag, boolean value) { AbstractOperator.Result FAIL = new AbstractOperator.Result(AbstractOperator.Result.FAILURE, "设置权限组 %s 的权限 %s 为 %s 失败", groupName, flag, value); AbstractOperator.Result SUCCESS = new AbstractOperator.Result(AbstractOperator.Result.SUCCESS, "设置权限组 %s 的权限 %s 为 %s 成功", groupName, flag, value); @@ -96,6 +120,15 @@ public static void setGroupFlag(AbstractOperator operator, String domName, Strin operator.setResponse(SUCCESS); } + /** + * 重命名权限组 + * + * @param operator 操作者 + * @param domName 领地名称 + * @param oldName 旧名称 + * @param newName 新名称 + * @param nameColored 新名称(带颜色) + */ public static void renameGroup(AbstractOperator operator, String domName, String oldName, String newName, String nameColored) { AbstractOperator.Result FAIL = new AbstractOperator.Result(AbstractOperator.Result.FAILURE, "重命名权限组 %s 为 %s 失败", oldName, newName); AbstractOperator.Result SUCCESS = new AbstractOperator.Result(AbstractOperator.Result.SUCCESS, "重命名权限组 %s 为 %s 成功", oldName, newName); @@ -125,6 +158,14 @@ public static void renameGroup(AbstractOperator operator, String domName, String operator.setResponse(SUCCESS); } + /** + * 添加成员到权限组 + * + * @param operator 操作者 + * @param domName 领地名称 + * @param groupName 权限组名称 + * @param playerName 玩家名称 + */ public static void addMember(AbstractOperator operator, String domName, String groupName, String playerName) { AbstractOperator.Result FAIL = new AbstractOperator.Result(AbstractOperator.Result.FAILURE, "添加成员 %s 到权限组 %s 失败", playerName, groupName); AbstractOperator.Result SUCCESS = new AbstractOperator.Result(AbstractOperator.Result.SUCCESS, "添加成员 %s 到权限组 %s 成功", playerName, groupName); @@ -172,6 +213,14 @@ public static void addMember(AbstractOperator operator, String domName, String g operator.setResponse(SUCCESS); } + /** + * 从权限组移除成员 + * + * @param operator 操作者 + * @param domName 领地名称 + * @param groupName 权限组名称 + * @param playerName 玩家名称 + */ public static void removeMember(AbstractOperator operator, String domName, String groupName, String playerName) { AbstractOperator.Result FAIL = new AbstractOperator.Result(AbstractOperator.Result.FAILURE, "从权限组 %s 移除成员 %s 失败", groupName, playerName); AbstractOperator.Result SUCCESS = new AbstractOperator.Result(AbstractOperator.Result.SUCCESS, "从权限组 %s 移除成员 %s 成功", groupName, playerName); diff --git a/core/src/main/java/cn/lunadeer/dominion/controllers/TemplateController.java b/core/src/main/java/cn/lunadeer/dominion/controllers/TemplateController.java index 306ed17d..491408b5 100644 --- a/core/src/main/java/cn/lunadeer/dominion/controllers/TemplateController.java +++ b/core/src/main/java/cn/lunadeer/dominion/controllers/TemplateController.java @@ -7,6 +7,12 @@ public class TemplateController { + /** + * 创建权限模板 + * + * @param operator 操作者 + * @param templateName 模板名称 + */ public static void createTemplate(AbstractOperator operator, String templateName) { AbstractOperator.Result SUCCESS = new AbstractOperator.Result(AbstractOperator.Result.SUCCESS, "创建成功"); AbstractOperator.Result FAIL = new AbstractOperator.Result(AbstractOperator.Result.FAILURE, "创建失败"); @@ -29,6 +35,12 @@ public static void createTemplate(AbstractOperator operator, String templateName operator.setResponse(SUCCESS.addMessage("成功创建名为 %s 的权限模板", templateName)); } + /** + * 删除权限模板 + * + * @param operator 操作者 + * @param templateName 模板名称 + */ public static void deleteTemplate(AbstractOperator operator, String templateName) { AbstractOperator.Result SUCCESS = new AbstractOperator.Result(AbstractOperator.Result.SUCCESS, "删除成功"); AbstractOperator.Result FAIL = new AbstractOperator.Result(AbstractOperator.Result.FAILURE, "删除失败"); @@ -45,6 +57,14 @@ public static void deleteTemplate(AbstractOperator operator, String templateName operator.setResponse(SUCCESS); } + /** + * 设置权限模板的权限 + * + * @param operator 操作者 + * @param templateName 模板名称 + * @param flag_name 权限名称 + * @param value 权限值 + */ public static void setTemplateFlag(AbstractOperator operator, String templateName, String flag_name, boolean value) { AbstractOperator.Result SUCCESS = new AbstractOperator.Result(AbstractOperator.Result.SUCCESS, "设置成功"); AbstractOperator.Result FAIL = new AbstractOperator.Result(AbstractOperator.Result.FAILURE, "设置失败");