From 1e167300ef58f6e6019b0794dbec16150e13e445 Mon Sep 17 00:00:00 2001 From: Flemmli97 Date: Tue, 15 Sep 2020 13:54:00 +0200 Subject: [PATCH] fix claim overlap at edge and wrong display for conflicting subclaims --- src/main/java/com/flemmli97/flan/claim/Claim.java | 4 ++-- .../java/com/flemmli97/flan/event/ItemInteractEvents.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/flemmli97/flan/claim/Claim.java b/src/main/java/com/flemmli97/flan/claim/Claim.java index 22aea99..c05b411 100644 --- a/src/main/java/com/flemmli97/flan/claim/Claim.java +++ b/src/main/java/com/flemmli97/flan/claim/Claim.java @@ -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 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; diff --git a/src/main/java/com/flemmli97/flan/event/ItemInteractEvents.java b/src/main/java/com/flemmli97/flan/event/ItemInteractEvents.java index ebbdfec..11e6061 100644 --- a/src/main/java/com/flemmli97/flan/event/ItemInteractEvents.java +++ b/src/main/java/com/flemmli97/flan/event/ItemInteractEvents.java @@ -160,7 +160,7 @@ public class ItemInteractEvents { Set 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);