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
  • MobCoinsReceiveEvent
  • MobCoinsRedeemEvent
  • MobCoinsSpawnEvent

Was this helpful?

  1. The-Only Plugin Series
  2. The-Only Mobcoins
  3. Developer API

Custom Events

All custom events that are available in this plugin

PreviousDeveloper APINextThe-Only Donations

Last updated 3 years ago

Was this helpful?

This event is called when players receive mobcoins from killing mobs that are specified or configured in mobs.yml and this event is cancellable.

Example Usage
@EventHandler
public void onCoinsReceived(MobCoinsReceiveEvent event){
    // Get the player that's involved in this event
    Player player = event.getPlayer();
    // We want to multiply the coins received if the
    // player has 'mobcoins.multiply.2' permissions.
    if(player.hasPermission("mobcoins.multiply.2")){
        // Get the amount player receives
        double coinsReceived = event.getAmountReceived();
        event.setAmountReceived((coinsReceived * 2));
    }
    // Get the amount received after being multiply
    double finalAmount = event.getAmountReceived();
    // We want to cancel the event if player recevies
    // mobcoins greather than 3000
    if(finalAmount > 3000){
        // If cancelled, player will not receives
        // the mobcoins
        event.setCancelled(true);
    }
}

This event is called when players redeem physical mobcoins.

Example Usage
@EventHandler
public void onCoinsRedeemed(MobCoinsRedeemEvent event){
    // Get the player that's involved in this event
    Player player = event.getPlayer();
    // We want to multiply the coins received if the
    // player has 'mobcoins.multiply.2' permissions.
    if(player.hasPermission("mobcoins.multiply.2")){
        // Get the amount player receives
        double coinsReceived = event.getAmount();
        event.setAmount((coinsReceived * 2));
    }
    // Get the amount received after being multiply
    double finalAmount = event.getAmountReceived();
    // We want to cancel the event if player recevies
    // mobcoins greather than 3000
    if(finalAmount > 3000){
        // If cancelled, player will not receives
        // the mobcoins
        event.setCancelled(true);
    }
}

This event is called when player kills a mobs and the mobs dropped a physical mobcoins.

Example Usage
@EventHandler
public void onCoinsSpawned(MobCoinsSpawnEvent event){
    // In this example, there is 50% chance that the drop
    // amount will be multiplied by 2
    // First we generate the random number
    int random = ThreadLocalRandom.current().nextInt(101);
    // We check if the random number is below or equals to 50
    if(random <= 50){
        // Get the drop amount
        double coinsDropped = event.getAmountToDrop();
        // Multiply the drop amount
        event.setAmountToDrop(coinsDropped * 2);
    }
}

MobCoinsReceiveEvent
MobCoinsRedeemEvent
MobCoinsSpawnEvent