API - alex9849/advanced-region-market GitHub Wiki
Maven Dependency
At first, you have to add AdvancedRegionMarket as a dependency to your project. If you use maven you have to add the Advanced-Region-Market repository:
<repositories>
<repository>
<id>alex9849</id>
<url>https://nexus.alex9849.net/repository/maven-releases/</url>
</repository>
</repositories>
If you want access to snapshot builds add this repository:
<repositories>
<repository>
<id>alex9849-snapshots</id>
<url>https://nexus.alex9849.net/repository/maven-snapshots/</url>
</repository>
</repositories>
Afterwards, you have to add AdvancedRegionMarket as a dependency to your project:
<dependencies>
<dependency>
<groupId>net.alex9849.advancedregionmarket</groupId>
<artifactId>advancedregionmarket</artifactId>
<version>3.5.3</version>
</dependency>
</dependencies>
Change the version field to the version that you want to use. You can use every released version beginning at 3.5.3
API
You can program your own plugins that make use of AdvancedRegionMarket by using its API.
There are some events that can be used:
- AddRegionEvent: Is called if a new region gets added to ARM.
- PreBuyEvent: Is called if a region is about to get bought.
- PreExtendEvent: Is called if a rentregion or contractregion gets extended.
- RemoveRegionEvent: Is called if a region gets removed from ARM.
- RestoreRegionEvent: Is called if a region gets restored. Not that restoration and reset is not the same. Region restore means, that everything that has been built on a region gets rolled back into its initial state. Reset means that is also gets unsold.
- UnsellRegionEvent: Is called if a region gets unsold. Not that this doesn't necessarily implies a region restore.
- UpdateRegionEvent: Is called if a some property of a region has been altered and the region gets maked as unsaved. All events are cancelable.
Examples:
Get all regions that contain a specitic location:
AdvancedRegionMarket.getInstance().getRegionManger().getRegionsByLocation(Location);
Iterate through all regions:
AdvancedRegionMarket.getInstance().getRegionManager()
Get all rentregions:
AdvancedRegionMarket.getInstance().getRegionManger().getRegionsBySelltype(SellType.RENT);