O Ideal é vc usar intersections, independente se o dono é o mesmo ou não, como vc faz aqui:
if (!regions2.isOwnerOfAll(localPlayer2)){
As variaveis não são iguais as suas, mas da pra ter uma noção de como fazer.
Exemplo:
RegionManager rm = AiQueVidaBandida.instancia.getWorldGuard().getRegionManager(p.getWorld());
BlockVector min2 = new BlockVector(mr.pcr.getMinimumPoint().getBlockX() - 3, 0, mr.pcr.getMinimumPoint().getBlockZ() -3);
BlockVector max2 = new BlockVector(mr.pcr.getMaximumPoint().getBlockX() + 3, 0, mr.pcr.getMaximumPoint().getBlockZ() +3);
ProtectedCuboidRegion pcr1 = new ProtectedCuboidRegion(mr.pcr.getId()+"1", min2, max2);
if(mr.terrenoOuExpandir >2){
rm.removeRegion(mr.deletarExpandida.getId());
}
rm.addRegion(pcr1);
ApplicableRegionSet set = rm.getApplicableRegions(pcr1);
Intersections in = new Intersections(p, set, pcr1.getId(), pcr1, false);
rm.removeRegion(pcr1.getId());
if(!in.isOwnerOfAll && in.hasRegion || in.hasSubRegion){
// p.sendMessage("§4Ocorreu um erro, nao foi possivel confirmar a compra, contate um administrador");
p.sendMessage("§4Ah um terreno muito proximo! não foi possivel confirmar a compra!");
Vc vai precisar disso tb:
public class Intersections {
public int size = 0;
public boolean isOwnerOfAll = true;
public boolean hasRegion = false;
public boolean hasSubRegion = false;
public boolean intersection3blocks = false;
public ProtectedRegion subRegion = null;
public ProtectedRegion region = null;
public ProtectedCuboidRegion distancia = null;
public String player;
public Intersections(Player p, ApplicableRegionSet set, String ignorar, ProtectedCuboidRegion pcr, boolean Expandir) {
this.distancia = pcr;
this.player = p.getName();
this.size = set.size();
for (ProtectedRegion pr : set) {
if (!pr.getId().equalsIgnoreCase(ignorar)) {
if (!this.isInsideOF3Blocks(pr) || (p.getLocation().getBlockX() > pr.getMinimumPoint().getBlockX()
&& p.getLocation().getBlockX() < pr.getMaximumPoint().getBlockX()
&& p.getLocation().getBlockZ() > pr.getMinimumPoint().getBlockZ()
&& p.getLocation().getBlockZ() < pr.getMaximumPoint().getBlockZ())) {
if (pr.getPriority() == 100) {
subRegion = pr;
hasSubRegion = true;
}
if (Expandir) {
if (pr.getPriority() == 50) {
if (!pr.getOwners().contains(p.getName().toLowerCase())) {
hasRegion = true;
region = pr;
}
}
} else {
if (pr.getPriority() == 50) {
hasRegion = true;
region = pr;
}
}
} else {
this.intersection3blocks = true;
}
if (!pr.isOwner(p.getName())) {
isOwnerOfAll = false;
}
}
}
}
public boolean isInsideRegion(Player p) {
return p.getLocation().getBlockX() >= region.getMinimumPoint().getBlockX()
&& p.getLocation().getBlockZ() >= region.getMinimumPoint().getBlockZ()
&& p.getLocation().getBlockX() <= region.getMaximumPoint().getBlockX()
&& p.getLocation().getBlockZ() <= region.getMaximumPoint().getBlockZ();
}
private boolean isInsideOF3Blocks(ProtectedRegion pr) {
return pr.getMinimumPoint().getBlockX() >= distancia.getMinimumPoint().getBlockX() - 3
&& pr.getMinimumPoint().getBlockZ() >= distancia.getMinimumPoint().getBlockZ() - 3
&& pr.getMaximumPoint().getBlockX() >= distancia.getMaximumPoint().getBlockX() - 3
&& pr.getMaximumPoint().getBlockZ() >= distancia.getMaximumPoint().getBlockZ() - 3;
}
public boolean isOneBlockInside(BlockVector min, BlockVector max) {
return min.getBlockX() > region.getMinimumPoint().getBlockX() + 1 && min.getBlockZ() > region.getMinimumPoint().getBlockZ() + 1
&& max.getBlockX() < region.getMaximumPoint().getBlockX() - 1 && max.getBlockZ() < region.getMaximumPoint().getBlockZ() - 1;
}