mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 06:28:49 +00:00
Update about menu appearance, button colors
This commit is contained in:
1 parent
e3194ba15a
commit
86c9251c37
2 files changed
+27
-9
No files matched your search
@@ -30,8 +30,8 @@ public class HuskHomesCommand extends CommandBase implements ConsoleExecutable,
|
|||||||
AboutMenu.Credit.of("Log1x").withDescription("Code"))
|
AboutMenu.Credit.of("Log1x").withDescription("Code"))
|
||||||
.addButtons(
|
.addButtons(
|
||||||
AboutMenu.Link.of("https://william278.net/docs/huskhomes").withText("Documentation").withIcon("⛏"),
|
AboutMenu.Link.of("https://william278.net/docs/huskhomes").withText("Documentation").withIcon("⛏"),
|
||||||
AboutMenu.Link.of("https://github.com/WiIIiam278/HuskHomes2/issues").withText("Issues").withIcon("❌"),
|
AboutMenu.Link.of("https://github.com/WiIIiam278/HuskHomes2/issues").withText("Issues").withIcon("❌").withColor("#ff9f0f"),
|
||||||
AboutMenu.Link.of("https://discord.gg/tVYhJfyDWG").withText("Discord").withIcon("⭐"));
|
AboutMenu.Link.of("https://discord.gg/tVYhJfyDWG").withText("Discord").withIcon("⭐").withColor("#6773f5"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class AboutMenu {
|
|||||||
private AboutMenu(@NotNull String title) {
|
private AboutMenu(@NotNull String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.buttons = new ArrayList<>();
|
this.buttons = new ArrayList<>();
|
||||||
this.attributions = new HashMap<>();
|
this.attributions = new LinkedHashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -64,7 +64,8 @@ public class AboutMenu {
|
|||||||
@NotNull
|
@NotNull
|
||||||
public MineDown toMineDown() {
|
public MineDown toMineDown() {
|
||||||
final StringJoiner menu = new StringJoiner("\n")
|
final StringJoiner menu = new StringJoiner("\n")
|
||||||
.add("[" + title + "](#00fb9a bold)" + (version != null ? " [| Version " + version + "](#00fb9a)" : ""));
|
.add("[" + Locales.escapeMineDown(title) + "](#00fb9a bold)"
|
||||||
|
+ (version != null ? " [| Version " + Locales.escapeMineDown(version.toString()) + "](#00fb9a)" : ""));
|
||||||
if (description != null) {
|
if (description != null) {
|
||||||
menu.add("[" + Locales.escapeMineDown(description) + "](gray)");
|
menu.add("[" + Locales.escapeMineDown(description) + "](gray)");
|
||||||
}
|
}
|
||||||
@@ -75,9 +76,10 @@ public class AboutMenu {
|
|||||||
for (Map.Entry<String, List<Credit>> entry : attributions.entrySet()) {
|
for (Map.Entry<String, List<Credit>> entry : attributions.entrySet()) {
|
||||||
final StringJoiner creditJoiner = new StringJoiner(", ");
|
final StringJoiner creditJoiner = new StringJoiner(", ");
|
||||||
for (final Credit credit : entry.getValue()) {
|
for (final Credit credit : entry.getValue()) {
|
||||||
creditJoiner.add("[" + credit.name + "](gray" +
|
creditJoiner.add("[" + credit.name + "](" + credit.color +
|
||||||
(credit.description != null ? " show_text=&7" + credit.description : "") +
|
(credit.description != null ? " show_text=&7" + Locales.escapeMineDown(credit.description) : "") +
|
||||||
(credit.url != null ? " open_url=" + MineDown.escape(credit.url) : "") + ")");
|
(credit.url != null ? " open_url=" + Locales.escapeMineDown(credit.url) : "")
|
||||||
|
+ ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!creditJoiner.toString().isBlank()) {
|
if (!creditJoiner.toString().isBlank()) {
|
||||||
@@ -89,8 +91,8 @@ public class AboutMenu {
|
|||||||
final StringJoiner buttonsJoiner = new StringJoiner(" ");
|
final StringJoiner buttonsJoiner = new StringJoiner(" ");
|
||||||
for (final Link link : buttons) {
|
for (final Link link : buttons) {
|
||||||
buttonsJoiner.add("[[" + (link.icon != null ? link.icon + " " : "")
|
buttonsJoiner.add("[[" + (link.icon != null ? link.icon + " " : "")
|
||||||
+ link.text + "…]](#00fb9a show_text=&7Click to open link open_url="
|
+ Locales.escapeMineDown(link.text) + "…]](" + link.color + " "
|
||||||
+ MineDown.escape(link.url) + ")");
|
+ "show_text=&7Click to open link open_url=" + Locales.escapeMineDown(link.url) + ")");
|
||||||
}
|
}
|
||||||
menu.add("").add("[Links:](gray) " + buttonsJoiner);
|
menu.add("").add("[Links:](gray) " + buttonsJoiner);
|
||||||
}
|
}
|
||||||
@@ -135,6 +137,9 @@ public class AboutMenu {
|
|||||||
@NotNull
|
@NotNull
|
||||||
private String text = "Link";
|
private String text = "Link";
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private String color = "#00fb9a";
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private String icon;
|
private String icon;
|
||||||
|
|
||||||
@@ -159,6 +164,11 @@ public class AboutMenu {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Link withColor(@NotNull String color) {
|
||||||
|
this.color = color;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Credit {
|
public static class Credit {
|
||||||
@@ -171,6 +181,9 @@ public class AboutMenu {
|
|||||||
@Nullable
|
@Nullable
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private String color = "gray";
|
||||||
|
|
||||||
private Credit(@NotNull String name) {
|
private Credit(@NotNull String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
@@ -189,6 +202,11 @@ public class AboutMenu {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Credit withColor(@NotNull String color) {
|
||||||
|
this.color = color;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user