mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2026-01-01 06:38:46 +01:00
Adjust to always check econ before merge
This commit is contained in:
@@ -157,14 +157,26 @@ public class Merge extends SubCommand {
|
|||||||
|
|
||||||
UUID uuid = player.getUUID();
|
UUID uuid = player.getUUID();
|
||||||
|
|
||||||
if (!force && !plot.isOwner(uuid)) {
|
if (!force) {
|
||||||
if (!player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_MERGE)) {
|
if (!plot.isOwner(uuid)) {
|
||||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
if (!player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_MERGE)) {
|
||||||
|
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
uuid = plot.getOwnerAbs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (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))))
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
uuid = plot.getOwnerAbs();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (direction == Direction.ALL) {
|
if (direction == Direction.ALL) {
|
||||||
boolean terrain = true;
|
boolean terrain = true;
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
@@ -181,17 +193,15 @@ public class Merge extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (plot.getPlotModificationManager().autoMerge(Direction.ALL, maxSize, uuid, player, terrain)) {
|
if (plot.getPlotModificationManager().autoMerge(Direction.ALL, maxSize, uuid, player, terrain)) {
|
||||||
if (this.econHandler.isEnabled(plotArea) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON) && price > 0d) {
|
this.econHandler.withdrawMoney(player, price);
|
||||||
this.econHandler.withdrawMoney(player, price);
|
player.sendMessage(
|
||||||
player.sendMessage(
|
TranslatableCaption.of("economy.removed_balance"),
|
||||||
TranslatableCaption.of("economy.removed_balance"),
|
TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price)))),
|
||||||
TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price)))),
|
TagResolver.resolver(
|
||||||
TagResolver.resolver(
|
"balance",
|
||||||
"balance",
|
Tag.inserting(Component.text(this.econHandler.format(this.econHandler.getMoney(player))))
|
||||||
Tag.inserting(Component.text(this.econHandler.format(this.econHandler.getMoney(player))))
|
)
|
||||||
)
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
|
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
|
||||||
eventDispatcher.callPostMerge(player, plot);
|
eventDispatcher.callPostMerge(player, plot);
|
||||||
return true;
|
return true;
|
||||||
@@ -199,14 +209,6 @@ public class Merge extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
|
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
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))))
|
|
||||||
);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final boolean terrain;
|
final boolean terrain;
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
terrain = "true".equalsIgnoreCase(args[1]);
|
terrain = "true".equalsIgnoreCase(args[1]);
|
||||||
|
|||||||
Reference in New Issue
Block a user