feat: add cost for the merge when using plot auto-merge

- Closes #3814
This commit is contained in:
dordsor21 2022-10-09 15:27:35 +01:00
parent 49b19e0eaf
commit 35dd4899b9
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B

View File

@ -293,10 +293,12 @@ public class Auto extends SubCommand {
}
if (this.econHandler != null && plotarea.useEconomy()) {
PlotExpression costExp = plotarea.getPrices().get("claim");
PlotExpression mergeCostExp = plotarea.getPrices().get("merge");
double mergeCost = mergeCostExp == null ? 0d : mergeCostExp.evaluate(sizeX * sizeZ);
double cost = costExp.evaluate(Settings.Limit.GLOBAL ?
player.getPlotCount() :
player.getPlotCount(plotarea.getWorldName()));
cost = (sizeX * sizeZ) * cost;
cost = (sizeX * sizeZ) * cost + mergeCost;
if (cost > 0d) {
if (!this.econHandler.isSupported()) {
player.sendMessage(TranslatableCaption.of("economy.vault_or_consumer_null"));