修复了领地管理员默认可能无法传送到领地的问题

This commit is contained in:
zhangyuheng 2024-07-29 15:11:30 +08:00
parent 5e5d45e1d7
commit 79d7f13a94
3 changed files with 19 additions and 16 deletions

View File

@ -6,7 +6,7 @@
<groupId>cn.lunadeer</groupId>
<artifactId>Dominion</artifactId>
<version>1.42.6-beta</version>
<version>1.42.7-beta</version>
<packaging>jar</packaging>
<name>Dominion</name>

View File

@ -22,6 +22,7 @@ import java.util.Map;
import static cn.lunadeer.dominion.DominionNode.isInDominion;
import static cn.lunadeer.dominion.commands.Apis.*;
import static cn.lunadeer.dominion.events.Apis.canByPass;
public class DominionOperate {
/**
@ -404,22 +405,22 @@ public class DominionOperate {
}
MemberDTO privilegeDTO = MemberDTO.select(player.getUniqueId(), dominionDTO.getId());
if (!player.getUniqueId().equals(dominionDTO.getOwner())) { // 领地所有人可以传送到自己的领地
if (!canByPass(player, dominionDTO, privilegeDTO)) {
if (privilegeDTO == null) {
if (!dominionDTO.getFlagValue(Flag.TELEPORT)) {
Notification.error(sender, "此领地禁止传送");
return;
}
} else {
if (privilegeDTO.getGroupId() == -1) {
if (!privilegeDTO.getFlagValue(Flag.TELEPORT)) {
Notification.error(sender, "你不被允许传送到这个领地");
GroupDTO groupDTO = Cache.instance.getGroup(privilegeDTO.getGroupId());
if (privilegeDTO.getGroupId() != -1 && groupDTO != null) {
if (!groupDTO.getFlagValue(Flag.TELEPORT)) {
Notification.error(sender, "你所在的权限组组不被允许传送到这个领地");
return;
}
} else {
GroupDTO groupDTO = Cache.instance.getGroup(privilegeDTO.getGroupId());
if (!groupDTO.getFlagValue(Flag.TELEPORT)) {
Notification.error(sender, "你所在的权限组组不被允许传送到这个领地");
if (!privilegeDTO.getFlagValue(Flag.TELEPORT)) {
Notification.error(sender, "你不被允许传送到这个领地");
return;
}
}

View File

@ -31,7 +31,12 @@ public class Apis {
return true;
}
if (prev != null) {
return prev.getAdmin();
if (prev.getGroupId() == -1) {
return prev.getAdmin();
} else {
GroupDTO group = Cache.instance.getGroup(prev.getGroupId());
return group != null && group.getAdmin();
}
}
return false;
}
@ -56,16 +61,13 @@ public class Apis {
return true;
}
if (prev != null) {
if (prev.getGroupId() == -1) {
if (prev.getFlagValue(flag)) {
GroupDTO group = Cache.instance.getGroup(prev.getGroupId());
if (prev.getGroupId() != -1 && group != null) {
if (group.getFlagValue(flag)) {
return true;
}
} else {
GroupDTO group = Cache.instance.getGroup(prev.getGroupId());
if (group == null) {
return false;
}
if (group.getFlagValue(flag)) {
if (prev.getFlagValue(flag)) {
return true;
}
}