mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 22:16:08 +00:00
Fixed not being possible to clear a home or warp's description
This commit is contained in:
1 parent
22ba7b4cf0
commit
571f35429d
3 files changed
+25
-27
No files matched your search
@@ -96,20 +96,17 @@ public class EditWarpCommand extends CommandBase implements TabCompletable, Cons
|
||||
}).ifPresent(editor::sendMessage));
|
||||
}
|
||||
case "description" -> {
|
||||
if (editArgs == null) {
|
||||
plugin.getLocales().getLocale("error_invalid_syntax",
|
||||
"/editwarp <name> description <new description>")
|
||||
.ifPresent(editor::sendMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
final String oldWarpDescription = warp.meta.description;
|
||||
final String newDescription = editArgs;
|
||||
final String newDescription = editArgs != null ? editArgs : "";
|
||||
|
||||
plugin.getSavedPositionManager().updateWarpMeta(warp, new PositionMeta(warp.meta.name, newDescription))
|
||||
.thenAccept(descriptionUpdateResult -> (switch (descriptionUpdateResult.resultType()) {
|
||||
case SUCCESS -> plugin.getLocales().getLocale("edit_warp_update_description",
|
||||
warp.meta.name, oldWarpDescription, newDescription);
|
||||
warp.meta.name,
|
||||
oldWarpDescription.isBlank() ? plugin.getLocales()
|
||||
.getRawLocale("item_no_description").orElse("N/A") : oldWarpDescription,
|
||||
newDescription.isBlank() ? plugin.getLocales()
|
||||
.getRawLocale("item_no_description").orElse("N/A") : newDescription);
|
||||
case FAILED_DESCRIPTION_LENGTH ->
|
||||
plugin.getLocales().getLocale("error_warp_description_length");
|
||||
case FAILED_DESCRIPTION_CHARACTERS ->
|
||||
|
||||
Reference in new issue
Block a user