Getting Started

How to start using the API

After you've added it as a dependency, you'll want to know how to start using the basic features of the API. On this page, we go over some basic getters for implementation.

Usage

Please note! It is highly recommended that these methods are run async! The API is very fast but if a server has lots of regions (10-20k+) it could halt the server for a few milliseconds dependent on the operation. See timings

Getting an Instance

In order to correctly use the API, you need to get an instance of the main module. The following code will get you an instance of the API class which houses the base methods for using the api.

API api = ProtectionAPI.getAPI();

If you type a "." after the getAPI() you should get a list of autocomplete features

Getting the regions

Getting the regions of a server is the main section you'll be using frequently.

API api = ProtectionAPI.getAPI();
List<UniversalRegion> regionList = api.getRegions();

Getting Region Providers

This method allows you to access the interface of each enabled protection plugin. This allows you to do more in-depth and provider-specific methods.

Get a list of all active providers:

API api = ProtectionAPI.getAPI();
List<Protection> rgProvider = api.getProtectionPlugins();

Get a specific provider:

API api = ProtectionAPI.getAPI();
Protection provider = api.getProtectionPluginAsInterface("WorldGuard")

Last updated