Check plot ownership/event before handling Direction.ALL

This commit is contained in:
dordsor21 2021-07-17 17:51:48 +01:00
parent 2e64ac6d25
commit 31522b6502
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B

View File

@ -157,6 +157,15 @@ public class Merge extends SubCommand {
final double price = priceExr == null ? 0d : priceExr.evaluate(size);
UUID uuid = player.getUUID();
if (!force && !plot.isOwner(uuid)) {
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_MERGE)) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
return false;
} else {
uuid = plot.getOwnerAbs();
}
}
if (direction == Direction.ALL) {
boolean terrain = true;
if (args.length == 2) {
@ -185,14 +194,6 @@ public class Merge extends SubCommand {
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
return false;
}
if (!force && !plot.isOwner(uuid)) {
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_MERGE)) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
return false;
} else {
uuid = plot.getOwnerAbs();
}
}
if (!force && this.econHandler.isEnabled(plotArea) && price > 0d
&& this.econHandler.getMoney(player) < price) {
player.sendMessage(