🖥️Getting Started

1. Adding HLootChest as a soft dependency.

First, please make sure to add HLootChest as a soft dependency.

softdepend: [HLootchest]

2. Adding HLootChest existence check.

You must add a check for HLootChest plugin existence, before initializing the API.

Checking if the plugin exists on the server startup, this check is important, otherwise your plugin won't work properly.

The sample check below will shut down the plugin, if it doesn't detect the plugin.

@Override
public void onEnable() {
    if (Bukkit.getPluginManager().getPlugin("HLootchest") == null) {
        getLogger().severe("HLootchest wasn't found. Disabling...");
        Bukkit.getPluginManager().disablePlugin(this);
        return;
    }
}

3. Initializing the API

The final step is to initialize the API, below shown the method to access it from Bukkit Services Manager.

HLootchest api = Bukkit.getServicesManager().getRegistration(HLootchest.class).getProvider();

Last updated