From 0471764641400dcb7d0af18a788e94803db6fe43 Mon Sep 17 00:00:00 2001 From: zhangyuheng Date: Mon, 12 Aug 2024 10:56:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=A2=86=E5=9C=B0=E4=BD=8F?= =?UTF-8?q?=E4=B8=BB=E5=8F=AF=E4=BB=A5=E4=BD=BF=E7=94=A8=E8=87=AA=E5=B7=B1?= =?UTF-8?q?=E9=A2=86=E5=9C=B0=E7=9A=84=E4=BB=BB=E6=84=8F=E7=9A=84=E6=9D=83?= =?UTF-8?q?=E9=99=90=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 9 +++++---- .../cn/lunadeer/dominion/commands/Title.java | 18 ++++++++++-------- .../cn/lunadeer/dominion/dtos/GroupDTO.java | 12 ++++++++++-- .../cn/lunadeer/dominion/tuis/TitleList.java | 7 +++++++ core/src/main/resources/config.yml | 5 +++-- 5 files changed, 35 insertions(+), 16 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index d45fcf3..f50e877 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } group = "cn.lunadeer" -version = "2.1.9-beta" +version = "2.1.12-beta" java { toolchain.languageVersion.set(JavaLanguageVersion.of(21)) @@ -40,6 +40,7 @@ allprojects { } tasks.processResources { + outputs.upToDateWhen { false } // replace @version@ in plugin.yml with project version filesMatching("**/plugin.yml") { filter { @@ -66,7 +67,7 @@ tasks.shadowJar { archiveVersion.set(project.version.toString()) } -tasks.register("buildPlugin") { - dependsOn(tasks.getByName("clean")) - dependsOn(tasks.getByName("shadowJar")) +tasks.register("buildPlugin") { // <<<< RUN THIS TASK TO BUILD PLUGIN + dependsOn(tasks.clean) + dependsOn(tasks.shadowJar) } \ No newline at end of file diff --git a/core/src/main/java/cn/lunadeer/dominion/commands/Title.java b/core/src/main/java/cn/lunadeer/dominion/commands/Title.java index 87805c9..faf0e99 100644 --- a/core/src/main/java/cn/lunadeer/dominion/commands/Title.java +++ b/core/src/main/java/cn/lunadeer/dominion/commands/Title.java @@ -45,14 +45,16 @@ public class Title { Notification.error(sender, "权限组 %s 所属领地不存在", group.getName()); return; } - MemberDTO member = Cache.instance.getMember(bukkit_player, dominion); - if (member == null) { - Notification.error(sender, "你不是 %s 的成员,无法使用其称号", dominion.getName()); - return; - } - if (!Objects.equals(member.getGroupId(), group.getId())) { - Notification.error(sender, "你不属于权限组 %s,无法使用其称号", group.getName()); - return; + if (!dominion.getOwner().equals(bukkit_player.getUniqueId())) { + MemberDTO member = Cache.instance.getMember(bukkit_player, dominion); + if (member == null) { + Notification.error(sender, "你不是 %s 的成员,无法使用其称号", dominion.getName()); + return; + } + if (!Objects.equals(member.getGroupId(), group.getId())) { + Notification.error(sender, "你不属于权限组 %s,无法使用其称号", group.getName()); + return; + } } player.setUsingGroupTitleID(group.getId()); Notification.info(sender, "成功使用权限组 %s 称号", group.getName()); diff --git a/core/src/main/java/cn/lunadeer/dominion/dtos/GroupDTO.java b/core/src/main/java/cn/lunadeer/dominion/dtos/GroupDTO.java index 705cb2d..0ad5cd6 100644 --- a/core/src/main/java/cn/lunadeer/dominion/dtos/GroupDTO.java +++ b/core/src/main/java/cn/lunadeer/dominion/dtos/GroupDTO.java @@ -39,12 +39,20 @@ public class GroupDTO { } public Component getNameColoredComponent() { - String with_pre_suf = Dominion.config.getGroupTitlePrefix() + (String) name_colored.value + Dominion.config.getGroupTitleSuffix(); + String with_pre_suf = "&#ffffff" + + Dominion.config.getGroupTitlePrefix() + + (String) name_colored.value + + "&#ffffff" + + Dominion.config.getGroupTitleSuffix(); return ColorParser.getComponentType(with_pre_suf); } public String getNameColoredBukkit() { - String with_pre_suf = Dominion.config.getGroupTitlePrefix() + (String) name_colored.value + Dominion.config.getGroupTitleSuffix(); + String with_pre_suf = "&#ffffff" + + Dominion.config.getGroupTitlePrefix() + + (String) name_colored.value + + "&#ffffff" + + Dominion.config.getGroupTitleSuffix(); return ColorParser.getBukkitType(with_pre_suf); } diff --git a/core/src/main/java/cn/lunadeer/dominion/tuis/TitleList.java b/core/src/main/java/cn/lunadeer/dominion/tuis/TitleList.java index 63e8eeb..19d0034 100644 --- a/core/src/main/java/cn/lunadeer/dominion/tuis/TitleList.java +++ b/core/src/main/java/cn/lunadeer/dominion/tuis/TitleList.java @@ -32,6 +32,13 @@ public class TitleList { List groups = Cache.instance.getBelongGroupsOf(player.getUniqueId()); GroupDTO using = Cache.instance.getPlayerUsingGroupTitle(player.getUniqueId()); + // 将其拥有的所有领地的权限组称号都加入列表 - 领地所有者可以使用其领地的任意权限组称号 + List dominions = DominionDTO.selectByOwner(player.getUniqueId()); + for (DominionDTO dominion : dominions) { + List groupsOfDom = GroupDTO.selectByDominionId(dominion.getId()); + groups.addAll(groupsOfDom); + } + for (GroupDTO group : groups) { DominionDTO dominion = Cache.instance.getDominion(group.getDomID()); Line line = Line.create(); diff --git a/core/src/main/resources/config.yml b/core/src/main/resources/config.yml index b01c4eb..03b7799 100644 --- a/core/src/main/resources/config.yml +++ b/core/src/main/resources/config.yml @@ -55,10 +55,11 @@ ResidenceMigration: false # 权限组称号 - 使用权限组当作称号(需要PlaceholderAPI插件) # Papi: %dominion_group_title% +# 前后缀如需要加颜色请使用这种格式 &#ffffff GroupTitle: Enable: false - Prefix: "&#ffffff[" - Suffix: "&#ffffff]" + Prefix: "[" + Suffix: "]" BlueMap: false Dynmap: false