From 02437a8c72849627d40c97f4b64d87ff48bddb64 Mon Sep 17 00:00:00 2001 From: Jordan Date: Sun, 21 May 2023 16:57:46 +0100 Subject: [PATCH] feat: add cost for the merge when using plot auto-merge (#3841) * feat: add cost for the merge when using plot auto-merge - Closes #3814 * fix: Don't charge for auto merge if there is no auto merge --------- Co-authored-by: Alexander Brandes --- Core/src/main/java/com/plotsquared/core/command/Auto.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/Auto.java b/Core/src/main/java/com/plotsquared/core/command/Auto.java index 2d6d3c27c..2490af981 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Auto.java +++ b/Core/src/main/java/com/plotsquared/core/command/Auto.java @@ -296,10 +296,13 @@ public class Auto extends SubCommand { } if (this.econHandler != null && plotarea.useEconomy()) { PlotExpression costExp = plotarea.getPrices().get("claim"); + PlotExpression mergeCostExp = plotarea.getPrices().get("merge"); + int size = sizeX * sizeZ; + double mergeCost = size > 1 && mergeCostExp == null ? 0d : mergeCostExp.evaluate(size); double cost = costExp.evaluate(Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(plotarea.getWorldName())); - cost = (sizeX * sizeZ) * cost; + cost = size * cost + mergeCost; if (cost > 0d) { if (!this.econHandler.isSupported()) { player.sendMessage(TranslatableCaption.of("economy.vault_or_consumer_null"));