新增领地住主可以使用自己领地的任意的权限组
All checks were successful
Java CI-CD with Gradle / build (push) Successful in 1h5m12s

This commit is contained in:
zhangyuheng 2024-08-12 10:56:53 +08:00
parent 53ec758ad4
commit 0471764641
5 changed files with 35 additions and 16 deletions

View File

@ -4,7 +4,7 @@ plugins {
} }
group = "cn.lunadeer" group = "cn.lunadeer"
version = "2.1.9-beta" version = "2.1.12-beta"
java { java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21)) toolchain.languageVersion.set(JavaLanguageVersion.of(21))
@ -40,6 +40,7 @@ allprojects {
} }
tasks.processResources { tasks.processResources {
outputs.upToDateWhen { false }
// replace @version@ in plugin.yml with project version // replace @version@ in plugin.yml with project version
filesMatching("**/plugin.yml") { filesMatching("**/plugin.yml") {
filter { filter {
@ -66,7 +67,7 @@ tasks.shadowJar {
archiveVersion.set(project.version.toString()) archiveVersion.set(project.version.toString())
} }
tasks.register("buildPlugin") { tasks.register("buildPlugin") { // <<<< RUN THIS TASK TO BUILD PLUGIN
dependsOn(tasks.getByName("clean")) dependsOn(tasks.clean)
dependsOn(tasks.getByName("shadowJar")) dependsOn(tasks.shadowJar)
} }

View File

@ -45,6 +45,7 @@ public class Title {
Notification.error(sender, "权限组 %s 所属领地不存在", group.getName()); Notification.error(sender, "权限组 %s 所属领地不存在", group.getName());
return; return;
} }
if (!dominion.getOwner().equals(bukkit_player.getUniqueId())) {
MemberDTO member = Cache.instance.getMember(bukkit_player, dominion); MemberDTO member = Cache.instance.getMember(bukkit_player, dominion);
if (member == null) { if (member == null) {
Notification.error(sender, "你不是 %s 的成员,无法使用其称号", dominion.getName()); Notification.error(sender, "你不是 %s 的成员,无法使用其称号", dominion.getName());
@ -54,6 +55,7 @@ public class Title {
Notification.error(sender, "你不属于权限组 %s无法使用其称号", group.getName()); Notification.error(sender, "你不属于权限组 %s无法使用其称号", group.getName());
return; return;
} }
}
player.setUsingGroupTitleID(group.getId()); player.setUsingGroupTitleID(group.getId());
Notification.info(sender, "成功使用权限组 %s 称号", group.getName()); Notification.info(sender, "成功使用权限组 %s 称号", group.getName());
} }

View File

@ -39,12 +39,20 @@ public class GroupDTO {
} }
public Component getNameColoredComponent() { 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); return ColorParser.getComponentType(with_pre_suf);
} }
public String getNameColoredBukkit() { 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); return ColorParser.getBukkitType(with_pre_suf);
} }

View File

@ -32,6 +32,13 @@ public class TitleList {
List<GroupDTO> groups = Cache.instance.getBelongGroupsOf(player.getUniqueId()); List<GroupDTO> groups = Cache.instance.getBelongGroupsOf(player.getUniqueId());
GroupDTO using = Cache.instance.getPlayerUsingGroupTitle(player.getUniqueId()); GroupDTO using = Cache.instance.getPlayerUsingGroupTitle(player.getUniqueId());
// 将其拥有的所有领地的权限组称号都加入列表 - 领地所有者可以使用其领地的任意权限组称号
List<DominionDTO> dominions = DominionDTO.selectByOwner(player.getUniqueId());
for (DominionDTO dominion : dominions) {
List<GroupDTO> groupsOfDom = GroupDTO.selectByDominionId(dominion.getId());
groups.addAll(groupsOfDom);
}
for (GroupDTO group : groups) { for (GroupDTO group : groups) {
DominionDTO dominion = Cache.instance.getDominion(group.getDomID()); DominionDTO dominion = Cache.instance.getDominion(group.getDomID());
Line line = Line.create(); Line line = Line.create();

View File

@ -55,10 +55,11 @@ ResidenceMigration: false
# 权限组称号 - 使用权限组当作称号(需要PlaceholderAPI插件) # 权限组称号 - 使用权限组当作称号(需要PlaceholderAPI插件)
# Papi: %dominion_group_title% # Papi: %dominion_group_title%
# 前后缀如需要加颜色请使用这种格式 &#ffffff
GroupTitle: GroupTitle:
Enable: false Enable: false
Prefix: "&#ffffff[" Prefix: "["
Suffix: "&#ffffff]" Suffix: "]"
BlueMap: false BlueMap: false
Dynmap: false Dynmap: false