mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-27 12:38:40 +01:00
Sign charge fees should go to the server account
This commit is contained in:
parent
31003ca29f
commit
116d22dd62
@ -4,10 +4,12 @@ import com.Acrobot.ChestShop.ChestShop;
|
|||||||
import com.Acrobot.ChestShop.Configuration.Messages;
|
import com.Acrobot.ChestShop.Configuration.Messages;
|
||||||
import com.Acrobot.ChestShop.Configuration.Properties;
|
import com.Acrobot.ChestShop.Configuration.Properties;
|
||||||
import com.Acrobot.ChestShop.Economy.Economy;
|
import com.Acrobot.ChestShop.Economy.Economy;
|
||||||
|
import com.Acrobot.ChestShop.Events.Economy.CurrencyAddEvent;
|
||||||
import com.Acrobot.ChestShop.Events.Economy.CurrencySubtractEvent;
|
import com.Acrobot.ChestShop.Events.Economy.CurrencySubtractEvent;
|
||||||
import com.Acrobot.ChestShop.Events.ShopCreatedEvent;
|
import com.Acrobot.ChestShop.Events.ShopCreatedEvent;
|
||||||
import com.Acrobot.ChestShop.Permission;
|
import com.Acrobot.ChestShop.Permission;
|
||||||
import com.Acrobot.ChestShop.Signs.ChestShopSign;
|
import com.Acrobot.ChestShop.Signs.ChestShopSign;
|
||||||
|
import com.Acrobot.ChestShop.UUIDs.NameManager;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -43,6 +45,14 @@ public class CreationFeeGetter implements Listener {
|
|||||||
CurrencySubtractEvent subtractionEvent = new CurrencySubtractEvent(BigDecimal.valueOf(shopCreationPrice), player);
|
CurrencySubtractEvent subtractionEvent = new CurrencySubtractEvent(BigDecimal.valueOf(shopCreationPrice), player);
|
||||||
ChestShop.callEvent(subtractionEvent);
|
ChestShop.callEvent(subtractionEvent);
|
||||||
|
|
||||||
|
if (!Economy.getServerAccountName().isEmpty()) {
|
||||||
|
CurrencyAddEvent currencyAddEvent = new CurrencyAddEvent(
|
||||||
|
BigDecimal.valueOf(shopCreationPrice),
|
||||||
|
NameManager.getUUID(Economy.getServerAccountName()),
|
||||||
|
player.getWorld());
|
||||||
|
ChestShop.callEvent(currencyAddEvent);
|
||||||
|
}
|
||||||
|
|
||||||
player.sendMessage(Messages.prefix(Messages.SHOP_FEE_PAID.replace("%amount", Economy.formatBalance(shopCreationPrice))));
|
player.sendMessage(Messages.prefix(Messages.SHOP_FEE_PAID.replace("%amount", Economy.formatBalance(shopCreationPrice))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.Acrobot.ChestShop.Configuration.Messages;
|
|||||||
import com.Acrobot.ChestShop.Configuration.Properties;
|
import com.Acrobot.ChestShop.Configuration.Properties;
|
||||||
import com.Acrobot.ChestShop.Economy.Economy;
|
import com.Acrobot.ChestShop.Economy.Economy;
|
||||||
import com.Acrobot.ChestShop.Events.Economy.CurrencyAddEvent;
|
import com.Acrobot.ChestShop.Events.Economy.CurrencyAddEvent;
|
||||||
|
import com.Acrobot.ChestShop.Events.Economy.CurrencySubtractEvent;
|
||||||
import com.Acrobot.ChestShop.Events.ShopDestroyedEvent;
|
import com.Acrobot.ChestShop.Events.ShopDestroyedEvent;
|
||||||
import com.Acrobot.ChestShop.Permission;
|
import com.Acrobot.ChestShop.Permission;
|
||||||
import com.Acrobot.ChestShop.UUIDs.NameManager;
|
import com.Acrobot.ChestShop.UUIDs.NameManager;
|
||||||
@ -36,6 +37,14 @@ public class ShopRefundListener implements Listener {
|
|||||||
CurrencyAddEvent currencyEvent = new CurrencyAddEvent(BigDecimal.valueOf(refundPrice), owner, event.getSign().getWorld());
|
CurrencyAddEvent currencyEvent = new CurrencyAddEvent(BigDecimal.valueOf(refundPrice), owner, event.getSign().getWorld());
|
||||||
ChestShop.callEvent(currencyEvent);
|
ChestShop.callEvent(currencyEvent);
|
||||||
|
|
||||||
|
if (!Economy.getServerAccountName().isEmpty()) {
|
||||||
|
CurrencySubtractEvent currencySubtractEvent = new CurrencySubtractEvent(
|
||||||
|
BigDecimal.valueOf(refundPrice),
|
||||||
|
NameManager.getUUID(Economy.getServerAccountName()),
|
||||||
|
event.getSign().getWorld());
|
||||||
|
ChestShop.callEvent(currencySubtractEvent);
|
||||||
|
}
|
||||||
|
|
||||||
String message = Messages.SHOP_REFUNDED.replace("%amount", Economy.formatBalance(refundPrice));
|
String message = Messages.SHOP_REFUNDED.replace("%amount", Economy.formatBalance(refundPrice));
|
||||||
event.getDestroyer().sendMessage(Messages.prefix(message));
|
event.getDestroyer().sendMessage(Messages.prefix(message));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user