Complete /edithome

This commit is contained in:
William committed 2022-08-16 19:03:04 +01:00
1 parent ced7ae3c35
commit 3651e1ea90
8 files changed
+210 -154

No files matched your search

@@ -43,57 +43,4 @@ public class Home extends SavedPosition {
this.isPublic = false;
}
@NotNull
public List<MineDown> getHomeEditorWindow(@NotNull Locales locales, final boolean otherViewer,
final boolean showServerInformation,
final boolean showUseButtons, final boolean showManagementButtons) {
return new ArrayList<>() {{
if (!otherViewer) {
locales.getLocale("edit_home_menu_title", meta.name)
.ifPresent(this::add);
} else {
locales.getLocale("edit_home_menu_title_other", owner.username, meta.name)
.ifPresent(this::add);
}
locales.getLocale("edit_home_menu_metadata_" + (!isPublic ? "private" : "public"),
DateTimeFormatter.ofPattern("MMM dd yyyy, HH:mm")
.format(meta.creationTime.atZone(ZoneId.systemDefault())),
uuid.toString().split(Pattern.quote("-"))[0],
uuid.toString())
.ifPresent(this::add);
if (meta.description.length() > 0) {
locales.getLocale("edit_home_menu_description", MineDown.escape(meta.description))
.ifPresent(this::add);
}
if (!showServerInformation) {
locales.getLocale("edit_home_menu_world", world.name).ifPresent(this::add);
} else {
locales.getLocale("edit_home_menu_world_server", world.name, server.name).ifPresent(this::add);
}
locales.getLocale("edit_home_menu_coordinates",
String.format("%.1f", x), String.format("%.1f", y), String.format("%.1f", z),
String.format("%.2f", yaw), String.format("%.2f", pitch))
.ifPresent(this::add);
final String formattedName = owner.username + "." + meta.name;
if (showUseButtons) {
locales.getLocale("edit_home_menu_use_buttons",
formattedName)
.ifPresent(this::add);
}
if (showManagementButtons) {
locales.getLocale("edit_home_menu_manage_buttons",
formattedName)
.ifPresent(this::add);
locales.getLocale("edit_home_menu_meta_edit_buttons",
formattedName)
.ifPresent(this::add);
}
}};
}
}