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 a31d17c46..826b981e6 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Auto.java +++ b/Core/src/main/java/com/plotsquared/core/command/Auto.java @@ -294,7 +294,7 @@ public class Auto extends SubCommand { return true; } } - if (this.econHandler != null && plotarea.useEconomy()) { + if (this.econHandler != null && plotarea.useEconomy() && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON)) { PlotExpression costExp = plotarea.getPrices().get("claim"); PlotExpression mergeCostExp = plotarea.getPrices().get("merge"); int size = sizeX * sizeZ; diff --git a/Core/src/main/java/com/plotsquared/core/command/Claim.java b/Core/src/main/java/com/plotsquared/core/command/Claim.java index e9848685c..d1f81d4fe 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Claim.java +++ b/Core/src/main/java/com/plotsquared/core/command/Claim.java @@ -141,7 +141,7 @@ public class Claim extends SubCommand { } } } - if (this.econHandler.isEnabled(area) && !force) { + if (this.econHandler.isEnabled(area) && !force && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON)) { PlotExpression costExr = area.getPrices().get("claim"); double cost = costExr.evaluate(currentPlots); if (cost > 0d) { diff --git a/Core/src/main/java/com/plotsquared/core/command/MainCommand.java b/Core/src/main/java/com/plotsquared/core/command/MainCommand.java index 1911f24e9..721bec05f 100644 --- a/Core/src/main/java/com/plotsquared/core/command/MainCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/MainCommand.java @@ -183,7 +183,7 @@ public class MainCommand extends Command { if (cmd.hasConfirmation(player)) { CmdConfirm.addPending(player, cmd.getUsage(), () -> { PlotArea area = player.getApplicablePlotArea(); - if (area != null && econHandler.isEnabled(area)) { + if (area != null && econHandler.isEnabled(area) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON)) { PlotExpression priceEval = area.getPrices().get(cmd.getFullId()); double price = priceEval != null ? priceEval.evaluate(0d) : 0d; @@ -201,7 +201,7 @@ public class MainCommand extends Command { return; } PlotArea area = player.getApplicablePlotArea(); - if (area != null && econHandler.isEnabled(area)) { + if (area != null && econHandler.isEnabled(area) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON)) { PlotExpression priceEval = area.getPrices().get(cmd.getFullId()); double price = priceEval != null ? priceEval.evaluate(0d) : 0d; if (price != 0d && econHandler.getMoney(player) < price) { diff --git a/Core/src/main/java/com/plotsquared/core/command/Merge.java b/Core/src/main/java/com/plotsquared/core/command/Merge.java index 97a3965c7..0e0650836 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Merge.java +++ b/Core/src/main/java/com/plotsquared/core/command/Merge.java @@ -178,7 +178,7 @@ public class Merge extends SubCommand { return true; } if (plot.getPlotModificationManager().autoMerge(Direction.ALL, maxSize, uuid, player, terrain)) { - if (this.econHandler.isEnabled(plotArea) && price > 0d) { + if (this.econHandler.isEnabled(plotArea) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON) && price > 0d) { this.econHandler.withdrawMoney(player, price); player.sendMessage( TranslatableCaption.of("economy.removed_balance"), @@ -196,8 +196,8 @@ public class Merge extends SubCommand { player.sendMessage(TranslatableCaption.of("merge.no_available_automerge")); return false; } - if (!force && this.econHandler.isEnabled(plotArea) && price > 0d - && this.econHandler.getMoney(player) < price) { + if (!force && this.econHandler.isEnabled(plotArea) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON) && price > 0d && this.econHandler.getMoney( + player) < price) { player.sendMessage( TranslatableCaption.of("economy.cannot_afford_merge"), TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price)))) @@ -218,7 +218,7 @@ public class Merge extends SubCommand { return true; } if (plot.getPlotModificationManager().autoMerge(direction, maxSize - size, uuid, player, terrain)) { - if (this.econHandler.isEnabled(plotArea) && price > 0d) { + if (this.econHandler.isEnabled(plotArea) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON) && price > 0d) { this.econHandler.withdrawMoney(player, price); player.sendMessage( TranslatableCaption.of("economy.removed_balance"), @@ -259,7 +259,7 @@ public class Merge extends SubCommand { accepter.sendMessage(TranslatableCaption.of("merge.merge_not_valid")); return; } - if (this.econHandler.isEnabled(plotArea) && price > 0d) { + if (this.econHandler.isEnabled(plotArea) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON) && price > 0d) { if (!force && this.econHandler.getMoney(player) < price) { player.sendMessage( TranslatableCaption.of("economy.cannot_afford_merge"), @@ -303,7 +303,7 @@ public class Merge extends SubCommand { player, terrain )) { - if (this.econHandler.isEnabled(plotArea) && price > 0d) { + if (this.econHandler.isEnabled(plotArea) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON) && price > 0d) { if (!force && this.econHandler.getMoney(player) < price) { player.sendMessage( TranslatableCaption.of("economy.cannot_afford_merge"), diff --git a/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java b/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java index fd8e5b5ab..fb76aef42 100644 --- a/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java +++ b/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java @@ -206,7 +206,7 @@ public class ComponentPresetManager { return false; } - if (componentPreset.cost() > 0.0D) { + if (componentPreset.cost() > 0.0D && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON)) { if (!econHandler.isEnabled(plot.getArea())) { getPlayer().sendMessage( TranslatableCaption.of("preset.economy_disabled"), diff --git a/Core/src/main/java/com/plotsquared/core/permissions/Permission.java b/Core/src/main/java/com/plotsquared/core/permissions/Permission.java index 43205ca3d..94b71761b 100644 --- a/Core/src/main/java/com/plotsquared/core/permissions/Permission.java +++ b/Core/src/main/java/com/plotsquared/core/permissions/Permission.java @@ -201,7 +201,8 @@ public enum Permission implements ComponentLike { PERMISSION_RATE("plots.rate"), PERMISSION_ADMIN_FLIGHT("plots.admin.flight"), PERMISSION_ADMIN_COMPONENTS_OTHER("plots.admin.component.other"), - PERMISSION_ADMIN_BYPASS_BORDER("plots.admin.border.bypass"); + PERMISSION_ADMIN_BYPASS_BORDER("plots.admin.border.bypass"), + PERMISSION_ADMIN_BYPASS_ECON("plots.admin.econ.bypass"); // private final String text;