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
@EventHandlerpublicvoidonCoinsReceived(MobCoinsReceiveEvent event){// Get the player that's involved in this eventPlayer 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 receivesdouble coinsReceived =event.getAmountReceived();event.setAmountReceived((coinsReceived *2)); }// Get the amount received after being multiplydouble finalAmount =event.getAmountReceived();// We want to cancel the event if player recevies// mobcoins greather than 3000if(finalAmount >3000){// If cancelled, player will not receives// the mobcoinsevent.setCancelled(true); }}
This event is called when players redeem physical mobcoins.
Example Usage
@EventHandlerpublicvoidonCoinsRedeemed(MobCoinsRedeemEvent event){// Get the player that's involved in this eventPlayer 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 receivesdouble coinsReceived =event.getAmount();event.setAmount((coinsReceived *2)); }// Get the amount received after being multiplydouble finalAmount =event.getAmountReceived();// We want to cancel the event if player recevies// mobcoins greather than 3000if(finalAmount >3000){// If cancelled, player will not receives// the mobcoinsevent.setCancelled(true); }}
This event is called when player kills a mobs and the mobs dropped a physical mobcoins.
Example Usage
@EventHandlerpublicvoidonCoinsSpawned(MobCoinsSpawnEvent event){// In this example, there is 50% chance that the drop// amount will be multiplied by 2// First we generate the random numberint random =ThreadLocalRandom.current().nextInt(101);// We check if the random number is below or equals to 50if(random <=50){// Get the drop amountdouble coinsDropped =event.getAmountToDrop();// Multiply the drop amountevent.setAmountToDrop(coinsDropped *2); }}