Fix /plot sethome returning usage message & working on unclaimed plots

This commit is contained in:
NotMyFault 2021-05-07 01:27:11 +02:00
parent 8bfdf8ecf2
commit 891230c78e
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
2 changed files with 9 additions and 2 deletions

View File

@ -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"),

View File

@ -316,7 +316,7 @@
"info.server": "<gray>Server</gray>",
"info.everyone": "<gray>Everyone</gray>",
"info.infinite": "<gray>Infinite</gray>",
"info.plot_unowned": "<prefix><gray>The current plot must have an owner to perform this action.</gray>",
"info.plot_unowned": "<prefix><red>The current plot must have an owner to perform this action.</red>",
"info.plot_info_unclaimed": "<prefix><gray>Plot <gold><plot></gold> is not yet claimed.</gray>",
"info.plot_info_header": "<dark_gray><strikethrough>--------- <reset><gold>INFO </gold><dark_gray><strikethrough>---------</dark_gray><reset>",
"info.plot_info_hidden": "<prefix><red>You cannot view the information about this plot.</red>",