mirror of
https://github.com/ColdeZhang/Dominion.git
synced 2024-10-19 00:36:40 +08:00
新增领地住主可以使用自己领地的任意的权限组
This commit is contained in:
parent
53ec758ad4
commit
0471764641
@ -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)
|
||||||
}
|
}
|
@ -45,14 +45,16 @@ public class Title {
|
|||||||
Notification.error(sender, "权限组 %s 所属领地不存在", group.getName());
|
Notification.error(sender, "权限组 %s 所属领地不存在", group.getName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MemberDTO member = Cache.instance.getMember(bukkit_player, dominion);
|
if (!dominion.getOwner().equals(bukkit_player.getUniqueId())) {
|
||||||
if (member == null) {
|
MemberDTO member = Cache.instance.getMember(bukkit_player, dominion);
|
||||||
Notification.error(sender, "你不是 %s 的成员,无法使用其称号", dominion.getName());
|
if (member == null) {
|
||||||
return;
|
Notification.error(sender, "你不是 %s 的成员,无法使用其称号", dominion.getName());
|
||||||
}
|
return;
|
||||||
if (!Objects.equals(member.getGroupId(), group.getId())) {
|
}
|
||||||
Notification.error(sender, "你不属于权限组 %s,无法使用其称号", group.getName());
|
if (!Objects.equals(member.getGroupId(), group.getId())) {
|
||||||
return;
|
Notification.error(sender, "你不属于权限组 %s,无法使用其称号", group.getName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
player.setUsingGroupTitleID(group.getId());
|
player.setUsingGroupTitleID(group.getId());
|
||||||
Notification.info(sender, "成功使用权限组 %s 称号", group.getName());
|
Notification.info(sender, "成功使用权限组 %s 称号", group.getName());
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user