Prevent claiming outside of the worldborder
This commit is contained in:
@@ -26,6 +26,7 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.World.Environment;
|
import org.bukkit.World.Environment;
|
||||||
|
import org.bukkit.WorldBorder;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@@ -767,4 +768,10 @@ public class Claim
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isInsideBorder() {
|
||||||
|
WorldBorder worldBorder = this.getLesserBoundaryCorner().getWorld().getWorldBorder();
|
||||||
|
return worldBorder.isInside(this.lesserBoundaryCorner) && worldBorder.isInside(this.greaterBoundaryCorner);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -965,6 +965,13 @@ public abstract class DataStore
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (creatingPlayer != null && newClaim.isInsideBorder()) {
|
||||||
|
result.succeeded = false;
|
||||||
|
result.claim = null;
|
||||||
|
creatingPlayer.sendMiniMessage("<red>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 worldguard is installed, also prevent claims from overlapping any worldguard regions
|
||||||
if (GriefPrevention.instance.config_claims_respectWorldGuard && this.worldGuard != null && creatingPlayer != null)
|
if (GriefPrevention.instance.config_claims_respectWorldGuard && this.worldGuard != null && creatingPlayer != null)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user