Call add and subtract event to give listeners a chance to handle them

This commit is contained in:
Phoenix616 2020-05-13 23:56:47 +01:00
parent 7b978ae022
commit 009febb5c2
1 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,6 @@
package com.Acrobot.ChestShop.Listeners.Economy;
import com.Acrobot.ChestShop.ChestShop;
import com.Acrobot.ChestShop.Events.Economy.AccountCheckEvent;
import com.Acrobot.ChestShop.Events.Economy.CurrencyAddEvent;
import com.Acrobot.ChestShop.Events.Economy.CurrencyAmountEvent;
@ -44,7 +45,7 @@ public abstract class EconomyAdapter implements Listener {
BigDecimal amountSent = event.getAmountSent();
CurrencySubtractEvent currencySubtractEvent = new CurrencySubtractEvent(amountSent, event.getSender(), event.getWorld());
if (!NameManager.isAdminShop(event.getSender())) {
onCurrencySubtraction(currencySubtractEvent);
ChestShop.callEvent(currencySubtractEvent);
} else {
currencySubtractEvent.setSubtracted(true);
}
@ -56,7 +57,7 @@ public abstract class EconomyAdapter implements Listener {
BigDecimal amountReceived = event.getAmountReceived().subtract(amountSent.subtract(currencySubtractEvent.getAmount()));
CurrencyAddEvent currencyAddEvent = new CurrencyAddEvent(amountReceived, event.getReceiver(), event.getWorld());
if (!NameManager.isAdminShop(event.getReceiver())) {
onCurrencyAdd(currencyAddEvent);
ChestShop.callEvent(currencyAddEvent);
} else {
currencyAddEvent.setAdded(true);
}
@ -69,7 +70,7 @@ public abstract class EconomyAdapter implements Listener {
event.getSender(),
event.getWorld()
);
onCurrencyAdd(currencyResetEvent);
ChestShop.callEvent(currencyResetEvent);
}
}