From 30175fb6d1aeb31f70492b85b383e05322777a27 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 26 Apr 2023 22:05:57 +0000 Subject: [PATCH 1/2] Bump org.junit.jupiter:junit-jupiter-api from 5.9.2 to 5.9.3 Bumps [org.junit.jupiter:junit-jupiter-api](https://github.com/junit-team/junit5) from 5.9.2 to 5.9.3. - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.9.2...r5.9.3) --- updated-dependencies: - dependency-name: org.junit.jupiter:junit-jupiter-api dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index f483246..ebd44d6 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ dependencies { compileOnly 'org.jetbrains:annotations:24.0.1' testImplementation 'net.kyori:adventure-platform-bukkit:4.3.0' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.3' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2' } From 211a48867dd4f3b88e6be34175244957d43e9481 Mon Sep 17 00:00:00 2001 From: William Date: Sun, 30 Apr 2023 21:02:38 +0100 Subject: [PATCH 2/2] Bump to 2.0.3, fix trailing commas, move credit descriptions to hover --- build.gradle | 2 +- .../desertwell/about/AboutMenu.java | 26 ++++++++++++++----- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index f483246..9e3c990 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ plugins { } group 'net.william278' -version '2.0.2' +version '2.0.3' defaultTasks 'licenseFormat', 'build' repositories { diff --git a/src/main/java/net/william278/desertwell/about/AboutMenu.java b/src/main/java/net/william278/desertwell/about/AboutMenu.java index edf085d..7f76c7e 100644 --- a/src/main/java/net/william278/desertwell/about/AboutMenu.java +++ b/src/main/java/net/william278/desertwell/about/AboutMenu.java @@ -23,6 +23,7 @@ import net.kyori.adventure.text.Component; import net.kyori.adventure.text.ComponentBuilder; import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.event.ClickEvent; +import net.kyori.adventure.text.event.HoverEvent; import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.TextColor; import net.kyori.adventure.text.format.TextDecoration; @@ -31,6 +32,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; /** * Utility for displaying a menu of information about a plugin @@ -83,18 +85,28 @@ public class AboutMenu { for (Map.Entry> entry : attributions.entrySet()) { builder.append(Component.newline()) .append(Component.text("• " + entry.getKey() + ": ").color(NamedTextColor.WHITE)); - entry.getValue().stream().map(Credit::toComponent).forEach(name -> builder - .append(name) - .append(Component.text(", "))); + + final AtomicInteger credits = new AtomicInteger(); + entry.getValue().stream().map(Credit::toComponent).forEach(name -> { + if (credits.getAndIncrement() > 0) { + builder.append(Component.text(", ")); + } + builder.append(name).color(secondaryColor); + }); } // Add buttons if (!buttons.isEmpty()) { builder.append(Component.newline()).append(Component.newline()) .append(Component.text("Links: ").color(secondaryColor)); - buttons.stream().map(Link::toComponent).forEach(link -> builder - .append(link) - .append(Component.text(" "))); + + final AtomicInteger links = new AtomicInteger(); + buttons.stream().map(Link::toComponent).forEach(link -> { + if (links.getAndIncrement() > 0) { + builder.append(Component.text(" ")); + } + builder.append(link); + }); } return builder.build(); @@ -344,7 +356,7 @@ public class AboutMenu { public Component toComponent() { final ComponentBuilder builder = Component.text().content(name); if (description != null) { - builder.append(Component.text(" (" + description + ")")); + builder.hoverEvent(HoverEvent.showText(Component.text(description, color))); } if (url != null) { builder.clickEvent(ClickEvent.openUrl(url));