-
Notifications
You must be signed in to change notification settings - Fork 0
API | Getting The API instance
Mantice edited this page Dec 19, 2023
·
1 revision
Use this to get the API instance:
MobCoinsAPI api = (MobCoinsAPI) Bukkit.getPluginManager().getPlugin("WarriorMobCoins");It is recommended to add the API to your main class and create a getter for it!
For example, in your main class:
// The MobCoinsAPI variable!
private MobCoinsAPI mobCoinsAPI;
@Override
public void onEnable() {
// Getting the API and setting mobCoinsAPI to it!
mobCoinsAPI = (MobCoinsAPI) getServer().getPluginManager().getPlugin("WarriorMobCoins");
}
// The MobCoinsAPI getter!
public MobCoinsAPI getMobCoinsAPI() { return mobCoinsAPI; }Once you have the API instance, you can get the CoinManager or ActionManager!
CoinManager coinManager = api.coinManager();
ActionManager actionManager = api.actionManager();