Adding your own region handler

Creating a region handler

Here is a template for a region handler:

import org.bukkit.Location;
import org.bukkit.event.player.PlayerMoveEvent;

import com.toomuchminecraft.generalregionapi.handlers.*;

@RegionHandler(plugin = "MyRegionPlugin") // 1
public class DefaultHandler extends RegionPluginHandler { //2

	@Override
	public boolean init() { // 3
		// Do anything required to initialise the handler here.
		// Do not make a constructor, it will break stuff.
		return false;
	}

	@Override
	public String[] getRegionsFromLocation(Location loc) { // 4
		// Use this to return a list of names of regions at the given location.
		return null;
	}

	@Override
	public boolean doesRegionExist(String region) { // 5
		// Use this to return if the specified region exists.
		return false;
	}

}
  1. Your class must have this annotation for it to be recognised as a region handler. The value for 'plugin' should be the name of the region plugin it supports as it appears in that plugin's plugin.yml.
  2. Your class must extend RegionPluginHandler to inherit the methods.
  3. This method is used to initialise the handler. Here is the place to initialise an attribute of the region plugin etc.
  4. This method is used to find all of the regions at a specified location in your plugin.
  5. This method is used to find if a region exists in your plugin.

If you have made a handler to support another region plugin, please message me on here so I can add it to the page.