diff --git a/pom.xml b/pom.xml
index 277f40a..6286982 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
cn.lunadeer
Dominion
- 1.42.6-beta
+ 1.42.7-beta
jar
Dominion
diff --git a/src/main/java/cn/lunadeer/dominion/commands/DominionOperate.java b/src/main/java/cn/lunadeer/dominion/commands/DominionOperate.java
index 63ac695..b97e5ad 100644
--- a/src/main/java/cn/lunadeer/dominion/commands/DominionOperate.java
+++ b/src/main/java/cn/lunadeer/dominion/commands/DominionOperate.java
@@ -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;
}
}
diff --git a/src/main/java/cn/lunadeer/dominion/events/Apis.java b/src/main/java/cn/lunadeer/dominion/events/Apis.java
index cd1163d..c691191 100644
--- a/src/main/java/cn/lunadeer/dominion/events/Apis.java
+++ b/src/main/java/cn/lunadeer/dominion/events/Apis.java
@@ -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;
}
}