From 891230c78e30ea3043ddcebf5639dbb20da0f412 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Fri, 7 May 2021 01:27:11 +0200 Subject: [PATCH] Fix `/plot sethome` returning usage message & working on unclaimed plots --- .../main/java/com/plotsquared/core/command/SetHome.java | 9 ++++++++- Core/src/main/resources/lang/messages_en.json | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/SetHome.java b/Core/src/main/java/com/plotsquared/core/command/SetHome.java index abfce7fc7..dd1c44b2e 100644 --- a/Core/src/main/java/com/plotsquared/core/command/SetHome.java +++ b/Core/src/main/java/com/plotsquared/core/command/SetHome.java @@ -42,6 +42,10 @@ public class SetHome extends SetCommand { @Override public boolean set(PlotPlayer player, Plot plot, String value) { + if (!plot.hasOwner()) { + player.sendMessage(TranslatableCaption.of("info.plot_unowned")); + return false; + } switch (value.toLowerCase()) { case "unset": case "reset": @@ -50,8 +54,9 @@ public class SetHome extends SetCommand { Plot base = plot.getBasePlot(false); base.setHome(null); player.sendMessage(TranslatableCaption.of("position.position_unset")); + return true; } - case "": + case "": { Plot base = plot.getBasePlot(false); Location bottom = base.getBottomAbs(); Location location = player.getLocationFull(); @@ -60,6 +65,8 @@ public class SetHome extends SetCommand { ); base.setHome(rel); player.sendMessage(TranslatableCaption.of("position.position_set")); + return true; + } default: player.sendMessage( TranslatableCaption.of("commandconfig.command_syntax"), diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index 161a60354..edfd47721 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -316,7 +316,7 @@ "info.server": "Server", "info.everyone": "Everyone", "info.infinite": "Infinite", - "info.plot_unowned": "The current plot must have an owner to perform this action.", + "info.plot_unowned": "The current plot must have an owner to perform this action.", "info.plot_info_unclaimed": "Plot is not yet claimed.", "info.plot_info_header": "--------- INFO ---------", "info.plot_info_hidden": "You cannot view the information about this plot.",