Disallow swapping ,erged plots

This commit is contained in:
Alexander Söderberg 2020-02-23 20:50:23 +01:00
parent 9eb41f05db
commit 8956aedd20
2 changed files with 6 additions and 5 deletions

View File

@ -40,11 +40,11 @@ public class Swap extends SubCommand {
Captions.PLOTWORLD_INCOMPATIBLE.send(player); Captions.PLOTWORLD_INCOMPATIBLE.send(player);
return false; return false;
} }
if (plot1.move(plot2, new Runnable() { if (plot1.isMerged() || plot2.isMerged()) {
@Override public void run() { Captions.SWAP_MERGED.send(player);
MainUtil.sendMessage(player, Captions.SWAP_SUCCESS); return false;
} }
}, true)) { if (plot1.move(plot2, () -> MainUtil.sendMessage(player, Captions.SWAP_SUCCESS), true)) {
return true; return true;
} else { } else {
MainUtil.sendMessage(player, Captions.SWAP_OVERLAP); MainUtil.sendMessage(player, Captions.SWAP_OVERLAP);

View File

@ -237,6 +237,7 @@ public enum Captions {
SWAP_DIMENSIONS("$2The proposed areas must have comparable dimensions", "Swap"), SWAP_DIMENSIONS("$2The proposed areas must have comparable dimensions", "Swap"),
SWAP_SYNTAX("$2/plot swap <id>", "Swap"), SWAP_SYNTAX("$2/plot swap <id>", "Swap"),
SWAP_SUCCESS("$4Successfully swapped plots", "Swap"), SWAP_SUCCESS("$4Successfully swapped plots", "Swap"),
SWAP_MERGED("$2Merged plots may not be swapped. Please unmerge the plot before performing the swap.", "Swap"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Comments"> //<editor-fold desc="Comments">
INBOX_NOTIFICATION("%s unread messages. Use /plot inbox", "Comment"), INBOX_NOTIFICATION("%s unread messages. Use /plot inbox", "Comment"),