Developer API
Example usage of how to use the plugin's api
Last updated
Was this helpful?
Example usage of how to use the plugin's api
Last updated
Was this helpful?
Check all custom events that are available on the plugin.
Normally you will use this to modify/get player's mobcoins. Keep in mind, method MobCoinsAPI#getPlayerData is nullable, so you'll have to null-check it first for safety.
public void modifyPlayerCoins(Player player){
// Firstly we get the player data
PlayerData playerData = MobCoinsAPI.getPlayerData();
// Return if the player data is null
if(playerData == null){
// Print something into the console
System.out.println("Modify Coins failed (reason: null player data)");
return;
}
// Now we can modify anything on the player data
// Adding coins to the player data
playerData.addCoins(10.25);
// Removing coins
playerData.removeCoins(5.50);
// See how much mobcoins does player have
System.out.println(player.getName() + " has " + playerData.getCoinsFormatted() + " coins");
}