新增领地住主可以使用自己领地的任意的权限组
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"
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)
}

View File

@ -45,6 +45,7 @@ public class Title {
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());
@ -54,6 +55,7 @@ public class Title {
Notification.error(sender, "你不属于权限组 %s无法使用其称号", group.getName());
return;
}
}
player.setUsingGroupTitleID(group.getId());
Notification.info(sender, "成功使用权限组 %s 称号", group.getName());
}

View File

@ -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);
}

View File

@ -32,6 +32,13 @@ public class TitleList {
List<GroupDTO> groups = Cache.instance.getBelongGroupsOf(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) {
DominionDTO dominion = Cache.instance.getDominion(group.getDomID());
Line line = Line.create();

View File

@ -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