From 79d7f13a94b7222ccd99fcf778fa4917df5b80f5 Mon Sep 17 00:00:00 2001 From: zhangyuheng Date: Mon, 29 Jul 2024 15:11:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E9=A2=86=E5=9C=B0?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E9=BB=98=E8=AE=A4=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E4=BC=A0=E9=80=81=E5=88=B0=E9=A2=86=E5=9C=B0?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../dominion/commands/DominionOperate.java | 15 ++++++++------- .../java/cn/lunadeer/dominion/events/Apis.java | 18 ++++++++++-------- 3 files changed, 19 insertions(+), 16 deletions(-) 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; } }