aglerr's Plugin Wiki
  • Welcome
  • aglerr's plugin
    • Player Profiles
      • Commands & Permissions
      • Options & Configuration
        • config.yml
        • custom-items.yml
    • Top Damage
  • The-Only Plugin Series
    • The-Only Mobcoins
      • Commands & Permissions
      • Placeholders
      • Plugin's files
        • config.yml
        • mobs.yml
        • shops
          • rotating-shop (WIP)
            • rotating-shop.yml (WIP)
          • category-shop (WIP)
            • categories (WIP)
              • weaponsAndTools.yml (WIP)
              • armor.yml (WIP)
            • category-shop.yml (WIP)
          • confirmation_menu.yml (WIP)
          • main_menu.yml (WIP)
      • Developer API
        • Custom Events
    • The-Only Donations
      • Commands & Permissions
      • Placeholders
      • Plugin's Files
        • config.yml
  • Additional Resources
    • Discord
    • My Spigot Resource
Powered by GitBook
On this page

Was this helpful?

  1. The-Only Plugin Series
  2. The-Only Mobcoins

Developer API

Example usage of how to use the plugin's api

Previousmain_menu.yml (WIP)NextCustom Events

Last updated 3 years ago

Was this helpful?

Check all custom events that are available on the plugin.

Getting Player Data

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.

Example Usage
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");
}

Feel free to contact us If you want something to be added to the plugin's API.

Custom Events
See the PlayerData class here.