fix claim overlap at edge and wrong display for conflicting subclaims
This commit is contained in:
parent
137ac03731
commit
1e167300ef
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user