Using the API

API

Methods

Where you see 'String regionType' this is the name of the plugin which defines the region

  • Region.getRegionsFromLocation(Loaction location) - This gets the names of all of the regions that are present at the specified location.
  • Region.getRegionsFromLocation(Location location, String regionType) - This gets the names of all of the regions of the specified type that are present at the specified location.
  • Region.isLocationInARegion(Location location) - This returns whether or not there is a region at the specified location.
  • Region.isLocationInARegion(Location location, String regionType) - This returns whether or not there is a region of the specified type at the location.
  • Region.isLocationInThisRegion(Location, String region) - This returns whether or not the specified location is within a region of the specified name.
  • Region.isLocationInThisRegion(Location, String region, String regionType) - This returns whether or not the specified location is within a region of the specified name and type.
  • Region.doesRegionExist(String region) - This returns whether or not there exists a region with the specified name.
  • Region.doesRegionExist(String region, String regionType) - This returns whether or not there exists a region with the specified name and type.

Events

RegionEnteredEvent

This event is triggered when a player enters a region.

It has the following additional methods:

  • getRegionID() - This returns the name of the region which this event is concerned with.
  • getPlayer() - This returns the Player object representing the player which entered the region.
  • getRegionType() - This returns the name of the plugin which handles the region this event is concerned with.
  • getMoveType() - This returns either MoveType.WALK or MoveType.TELEPORT depending on how the player entered the region.

RegionLeftEvent

This event is triggered when a player leaves a region.

It has the following additional methods:

  • getRegionID() - This returns the name of the region which this event is concerned with.
  • getPlayer() - This returns the Player object representing the player which left the region.
  • getRegionType() - This returns the name of the plugin which handles the region this event is concerned with.
  • getMoveType() - This returns either MoveType.WALK or MoveType.TELEPORT depending on how the player left the region.