mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Replaced economy supported (Vault) check within cost condition with a pre-eliminating if-guard (#3014)
This commit is contained in:
parent
ca7ac71e76
commit
68eb5cd74f
@ -312,15 +312,16 @@ public class Auto extends SubCommand {
|
||||
player.getPlotCount(plotarea.getWorldName()));
|
||||
cost = (size_x * size_z) * cost;
|
||||
if (cost > 0d) {
|
||||
if (!force && this.econHandler.getMoney(player) < cost && this.econHandler.isSupported()) {
|
||||
if (!this.econHandler.isSupported()) {
|
||||
player.sendMessage(TranslatableCaption.of("economy.vault_not_found"));
|
||||
return false;
|
||||
}
|
||||
if (!force && this.econHandler.getMoney(player) < cost) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("economy.cannot_afford_plot"),
|
||||
Template.of("money", this.econHandler.format(cost)),
|
||||
Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player)))
|
||||
);
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("economy.vault_not_found"));
|
||||
return false;
|
||||
}
|
||||
this.econHandler.withdrawMoney(player, cost);
|
||||
player.sendMessage(
|
||||
|
@ -151,15 +151,16 @@ public class Claim extends SubCommand {
|
||||
PlotExpression costExr = area.getPrices().get("claim");
|
||||
double cost = costExr.evaluate(currentPlots);
|
||||
if (cost > 0d) {
|
||||
if (this.econHandler.getMoney(player) < cost && this.econHandler.isSupported()) {
|
||||
if (!this.econHandler.isSupported()) {
|
||||
player.sendMessage(TranslatableCaption.of("economy.vault_not_found"));
|
||||
return false;
|
||||
}
|
||||
if (this.econHandler.getMoney(player) < cost) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("economy.cannot_afford_plot"),
|
||||
Template.of("money", this.econHandler.format(cost)),
|
||||
Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player)))
|
||||
);
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("economy.vault_not_found"));
|
||||
return false;
|
||||
}
|
||||
this.econHandler.withdrawMoney(player, cost);
|
||||
player.sendMessage(
|
||||
|
Loading…
Reference in New Issue
Block a user