Creating a UniversalRegion
Universal Regions are the home to most of the important methods. Learn how to make one!
Regions
The API is documented. You can view the code and most up-to-date code and new methods here
UniversalRegion abstract
UniversalRegion is an abstract class type. Therefore you cannot create an instance of it directly. To create your own universal region class type you have to use the child class Region3D
new Region3D();
Furthermore, the Region3D class requires the parameters: World, Vector...
So, to create a region based off of a simple min and max point, you would write the following code:
Vector min = new Vector(0,0,0);
Vector max = new Vector(5,10,5);
World world = Bukkit.getWorld("world");
// Create the region
new Region3D(world, min, max);
Creating a Polygon Region
To create a polygon region, you need to specify all the points when creating the Region3D
object. It's important that you input the points in the correct path order to create the object. Otherwise instead of looking like this:

It will look like this:

Example Code:
Vector point1 = new Vector(0,0,0);
Vector point2 = new Vector(0,0,5);
Vector point3 = new Vector(5,0,0);
World world = Bukkit.getWorld("world");
new Region3D(world, point1, point2, point3);
Adding Region Attributes
The UniversalRegion has a Builder Pattern. This means you can string along your setters in one long path.
new Region3d(world, point1, point2)
.setDateCreated(date)
.setAdmins(admins)
.setOwners(owners)
.setMembers(members);
Last updated
Was this helpful?