mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 14:38:52 +00:00
Adjust description formatting, remove default descriptions, add item_no_description locale
This commit is contained in:
1 parent
12020ca70a
commit
22ba7b4cf0
7 files changed
+36
-20
No files matched your search
@@ -303,7 +303,7 @@ public class EditHomeCommand extends CommandBase implements TabCompletable, Cons
|
||||
plugin.getLocales().getLocale("edit_home_menu_description",
|
||||
home.meta.description.length() > 50
|
||||
? home.meta.description.substring(0, 49).trim() + "…" : home.meta.description,
|
||||
String.join("\n", home.meta.description.split("(?<=\\G.{40,}\\s)")))
|
||||
plugin.getLocales().formatDescription(home.meta.description))
|
||||
.ifPresent(this::add);
|
||||
}
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ public class EditWarpCommand extends CommandBase implements TabCompletable, Cons
|
||||
plugin.getLocales().getLocale("edit_warp_menu_description",
|
||||
warp.meta.description.length() > 50
|
||||
? warp.meta.description.substring(0, 49).trim() + "…" : warp.meta.description,
|
||||
String.join("\n", warp.meta.description.split("(?<=\\G.{40,}\\s)")))
|
||||
plugin.getLocales().formatDescription(warp.meta.description))
|
||||
.ifPresent(this::add);
|
||||
}
|
||||
|
||||
|
||||
@@ -85,8 +85,7 @@ public class SetHomeCommand extends CommandBase {
|
||||
|
||||
// Set the home in the saved position manager
|
||||
final SavedPositionManager.SaveResult setResult = plugin.getSavedPositionManager()
|
||||
.setHome(new PositionMeta(homeName, plugin.getLocales().getRawLocale("home_default_description",
|
||||
onlineUser.username).orElse("")), onlineUser, onlineUser.getPosition().join()).join();
|
||||
.setHome(new PositionMeta(homeName, ""), onlineUser, onlineUser.getPosition().join()).join();
|
||||
|
||||
// Display feedback of the result of the set operation
|
||||
(switch (setResult.resultType()) {
|
||||
|
||||
@@ -26,18 +26,19 @@ public class SetWarpCommand extends CommandBase {
|
||||
}
|
||||
|
||||
private void setWarp(@NotNull OnlineUser onlineUser, @NotNull String warpName) {
|
||||
onlineUser.getPosition().thenAccept(position -> plugin.getSavedPositionManager().setWarp(new PositionMeta(warpName,
|
||||
plugin.getLocales().getRawLocale("warp_default_description").orElse("")),
|
||||
position).thenAccept(setResult -> (switch (setResult.resultType()) {
|
||||
case SUCCESS -> {
|
||||
assert setResult.savedPosition().isPresent();
|
||||
yield plugin.getLocales().getLocale("set_warp_success", setResult.savedPosition().get().meta.name);
|
||||
}
|
||||
case FAILED_DUPLICATE -> plugin.getLocales().getLocale("error_warp_name_taken");
|
||||
case FAILED_NAME_LENGTH -> plugin.getLocales().getLocale("error_warp_name_length");
|
||||
case FAILED_NAME_CHARACTERS -> plugin.getLocales().getLocale("error_warp_name_characters");
|
||||
default -> Optional.of(new MineDown(""));
|
||||
}).ifPresent(onlineUser::sendMessage)));
|
||||
onlineUser.getPosition().thenAccept(position -> plugin.getSavedPositionManager().setWarp(
|
||||
new PositionMeta(warpName, ""), position).thenAccept(setResult ->
|
||||
(switch (setResult.resultType()) {
|
||||
case SUCCESS -> {
|
||||
assert setResult.savedPosition().isPresent();
|
||||
yield plugin.getLocales().getLocale("set_warp_success",
|
||||
setResult.savedPosition().get().meta.name);
|
||||
}
|
||||
case FAILED_DUPLICATE -> plugin.getLocales().getLocale("error_warp_name_taken");
|
||||
case FAILED_NAME_LENGTH -> plugin.getLocales().getLocale("error_warp_name_length");
|
||||
case FAILED_NAME_CHARACTERS -> plugin.getLocales().getLocale("error_warp_name_characters");
|
||||
default -> Optional.of(new MineDown(""));
|
||||
}).ifPresent(onlineUser::sendMessage)));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user