mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
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 <mc.cache@web.de>
This commit is contained in:
parent
958c66b28f
commit
02437a8c72
@ -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"));
|
||||
|
Loading…
Reference in New Issue
Block a user