fix claim overlap at edge and wrong display for conflicting subclaims

This commit is contained in:
Flemmli97 2020-09-15 13:54:00 +02:00
parent 137ac03731
commit 1e167300ef
2 changed files with 3 additions and 3 deletions

View File

@ -148,7 +148,7 @@ public class Claim {
}
public boolean intersects(Claim other) {
return this.minX < other.maxX && this.maxX > other.minX && this.minZ < other.maxZ && this.maxZ > other.minZ;
return this.minX <= other.maxX && this.maxX >= other.minX && this.minZ <= other.maxZ && this.maxZ >= other.minZ;
}
public boolean isCorner(BlockPos pos) {
@ -239,7 +239,7 @@ public class Claim {
Set<Claim> conflicts = Sets.newHashSet();
for (Claim other : this.subClaims)
if (sub.intersects(other)) {
conflicts.add(sub);
conflicts.add(other);
}
if (conflicts.isEmpty()) {
sub.parent = this.claimID;

View File

@ -160,7 +160,7 @@ public class ItemInteractEvents {
Set<Claim> fl = claim.tryCreateSubClaim(data.editingCorner(), target);
data.addDisplayClaim(claim, EnumDisplayType.MAIN, player.getBlockPos().getY());
if (!fl.isEmpty()) {
fl.forEach(confl -> data.addDisplayClaim(confl, EnumDisplayType.MAIN, player.getBlockPos().getY()));
fl.forEach(confl -> data.addDisplayClaim(confl, EnumDisplayType.CONFLICT, player.getBlockPos().getY()));
player.sendMessage(PermHelper.simpleColoredText(ConfigHandler.lang.conflictOther, Formatting.RED), false);
} else {
player.sendMessage(PermHelper.simpleColoredText(ConfigHandler.lang.subClaimCreateSuccess, Formatting.GOLD), false);