Skip to content

Commit

Permalink
Merge pull request #810
Browse files Browse the repository at this point in the history
Lands
  • Loading branch information
SirBlobman committed May 9, 2024
2 parents a06e431 + 226bcbd commit 685de49
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion expansion/compatibility/Lands/build.gradle.kts
Expand Up @@ -4,5 +4,5 @@ repositories {

dependencies {
compileOnly(project(":expansion:newbie-helper"))
compileOnly("com.github.Angeschossen:LandsAPI:6.42.0")
compileOnly("com.github.Angeschossen:LandsAPI:6.44.13")
}
Expand Up @@ -2,6 +2,7 @@

import java.util.UUID;

import me.angeschossen.lands.api.player.LandPlayer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -48,6 +49,12 @@ public boolean isSafeZone(@NotNull Player player, @NotNull Location location, @N
}

Entity enemy = tag.getCurrentEnemy();
if (enemy instanceof Player) { // if target is player, check for attack flag and wars. this makes sure that BOTH players are allowed to fight, not just the attacker, since attackers can only attack players that are allowed to fight back
LandPlayer attacker = landsIntegration.getLandPlayer(player.getUniqueId()), target = landsIntegration.getLandPlayer(enemy.getUniqueId());
return !area.canPvP(attacker, target, false) // if one of them can't fight, consider as safe zone, since it results in both of them not being able to fight in area
|| area.canEnter(attacker, false) != area.canEnter(target, false); // if both of them can't enter: ignore, their entry will be denied by Lands anyway. Otherwise, make sure both of them can enter
}

TagType tagType = tag.getCurrentTagType();
RoleFlag roleFlag = getRoleFlag(tagType, enemy);
if (roleFlag == null) {
Expand Down

0 comments on commit 685de49

Please sign in to comment.