🖥️Getting started

Developers API only on v1.x

public class Main extends JavaPlugin {

    private IMiniPvpApi miniPvpApi;

    @Override
    public void onEnable() {
        if (!initMiniPvpApi()){
            Bukkit.getLogger().severe("Please download T-MiniPvP!");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
    }

    public IMiniPvpApi getMiniPvpApi() {
        return miniPvpApi;
    }

    private boolean initMiniPvpApi() {
        if (getServer().getPluginManager().getPlugin("T-MiniPvP") == null) {
            return false;
        }
        RegisteredServiceProvider<IMiniPvpApi> registeredServiceProvider = getServer().getServicesManager().getRegistration(IMiniPvpApi.class);
        if (registeredServiceProvider == null) {
            return false;
        }
        miniPvpApi = registeredServiceProvider.getProvider();
        return miniPvpApi != null;
    }
}

You have to remember add plugin to depend section in your plugin.yml

depend:
  - T-MiniPvP

Last updated