diff --git a/src/main/java/me/ryanhamshire/GriefPrevention/Claim.java b/src/main/java/me/ryanhamshire/GriefPrevention/Claim.java index f060f2e..dcd9bb6 100644 --- a/src/main/java/me/ryanhamshire/GriefPrevention/Claim.java +++ b/src/main/java/me/ryanhamshire/GriefPrevention/Claim.java @@ -26,6 +26,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.World.Environment; +import org.bukkit.WorldBorder; import org.bukkit.block.Block; import org.bukkit.block.BlockState; import org.bukkit.entity.Entity; @@ -767,4 +768,10 @@ public class Claim } return true; } + + public boolean isInsideBorder() { + WorldBorder worldBorder = this.getLesserBoundaryCorner().getWorld().getWorldBorder(); + return worldBorder.isInside(this.lesserBoundaryCorner) && worldBorder.isInside(this.greaterBoundaryCorner); + } + } diff --git a/src/main/java/me/ryanhamshire/GriefPrevention/DataStore.java b/src/main/java/me/ryanhamshire/GriefPrevention/DataStore.java index e973461..d88af6c 100644 --- a/src/main/java/me/ryanhamshire/GriefPrevention/DataStore.java +++ b/src/main/java/me/ryanhamshire/GriefPrevention/DataStore.java @@ -965,6 +965,13 @@ public abstract class DataStore return result; } + if (creatingPlayer != null && newClaim.isInsideBorder()) { + result.succeeded = false; + result.claim = null; + creatingPlayer.sendMiniMessage("You can't claim outside of the worldborder", null); // TODO MINIMESSAG + CONFIG + return result; + } + //if worldguard is installed, also prevent claims from overlapping any worldguard regions if (GriefPrevention.instance.config_claims_respectWorldGuard && this.worldGuard != null && creatingPlayer != null) {