修复op无法绕过出生点保护问题
Some checks failed
Java CI-CD with Gradle / build (push) Has been cancelled

This commit is contained in:
zhangyuheng 2024-08-12 16:32:34 +08:00
parent 0471764641
commit a66014227c
2 changed files with 13 additions and 7 deletions

View File

@ -4,7 +4,7 @@ plugins {
}
group = "cn.lunadeer"
version = "2.1.12-beta"
version = "2.1.13-beta"
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
@ -20,8 +20,8 @@ allprojects {
apply(plugin = "com.github.johnrengelman.shadow")
repositories {
mavenCentral()
mavenLocal()
mavenCentral()
maven("https://oss.sonatype.org/content/groups/public")
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://jitpack.io")
@ -35,7 +35,7 @@ allprojects {
compileOnly("us.dynmap:DynmapCoreAPI:3.4")
compileOnly("me.clip:placeholderapi:2.11.6")
implementation("cn.lunadeer:MinecraftPluginUtils:1.3.4-SNAPSHOT")
implementation("cn.lunadeer:MinecraftPluginUtils:1.3.7-SNAPSHOT")
implementation("org.yaml:snakeyaml:2.0")
}

View File

@ -156,7 +156,7 @@ public class DominionController {
// 获取此领地的所有同级领地
List<DominionDTO> sub_dominions = DominionDTO.selectByParentId(dominion.getWorld(), parent_dominion.getId());
// 检查是否与出生点保护冲突
if (isIntersectSpawn(dominion)) {
if (isIntersectSpawn(operator, dominion)) {
operator.setResponse(FAIL.addMessage("与出生点保护冲突"));
return;
}
@ -183,7 +183,10 @@ public class DominionController {
operator.setResponse(SUCCESS);
}
private static boolean isIntersectSpawn(DominionDTO dominion) {
private static boolean isIntersectSpawn(AbstractOperator operator, DominionDTO dominion) {
if (operator.isOp() && Dominion.config.getLimitOpBypass()) {
return false;
}
int radius = Dominion.config.getSpawnProtection();
if (radius == -1) {
return false;
@ -197,7 +200,10 @@ public class DominionController {
, spawn.getBlockX() + radius, spawn.getBlockY() + radius, spawn.getBlockZ() + radius);
}
private static boolean isIntersectSpawn(String world, int[] cords) {
private static boolean isIntersectSpawn(AbstractOperator operator, String world, int[] cords) {
if (operator.isOp() && Dominion.config.getLimitOpBypass()) {
return false;
}
int radius = Dominion.config.getSpawnProtection();
if (radius == -1) {
return false;
@ -242,7 +248,7 @@ public class DominionController {
return;
}
// 检查是否与出生点保护冲突
if (isIntersectSpawn(dominion.getWorld(), newCords)) {
if (isIntersectSpawn(operator, dominion.getWorld(), newCords)) {
operator.setResponse(FAIL.addMessage("与出生点保护冲突"));
return;
}