BlurpRegion

BlurpRegion is a builder-style utility for defining and managing custom regions in plugins.

Features

  • Builder pattern to define multiple named regions (cuboid, sphere, cylinder, polygon)

  • Check if a Location is inside a region

  • Retrieve all blocks contained within a region

  • Supports custom polygon regions via a list of points

  • Simple, fluent API for region management in Minecraft

Usage

Basic Example

BlurpRegion regions = new BlurpRegion()
    .cuboid("maison", loc1, loc2)
    .sphere("arena", center, 10)
    .cylinder("tour", center, 5, 20);

boolean inside = regions.isInRegion("arena", player.getLocation());
if (inside) {
    // The player is inside the "arena" region
}

Polygon Region

List<Location> points = List.of(point1, point2, point3, point4, point1);
regions.polygon("zone", points);

if (regions.isInRegion("zone", player.getLocation())) {
    // The player is inside the polygonal zone
}

Get All Blocks in a Region

List<Location> blocks = regions.getBlocksInRegion("house");
for (Location blockLoc : blocks) {
    // Do something with each block in the "house" region
}

API Reference

Method
Description

cuboid(name, loc1, loc2)

Defines a cuboid region between two corner locations.

sphere(name, center, radius)

Defines a spherical region with a center and radius.

cylinder(name, center, radius, height)

Defines a vertical cylinder region with a center, radius, and height.

polygon(name, points)

Defines a polygon region from a list of points (all in the same world).

isInRegion(name, location)

Returns true if the given location is inside the specified region.

getBlocksInRegion(name)

Returns a list of all block locations contained within the specified region.

Notes

  • Regions are identified by their name (string)

  • All calculations are performed using block coordinates

  • Polygon regions should be closed (first and last points identical)

  • For polygons, all points must be in the same world

Last updated