From b71c1d119635845df8e5fc8bc73169840ac11d83 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 13 May 2026 23:14:25 +0000 Subject: [PATCH 1/4] Update adventure to v5 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2201abcb28..16d63b0408 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ checkerqual = "4.1.0" gson = "2.10" guava = "31.1-jre" snakeyaml = "2.0" -adventure = "4.26.1" +adventure = "5.1.1" adventure-bukkit = "4.4.1" log4j = "2.19.0" From bb257b29ef3e664701dfe5dca9fee837401efecd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 14 Jun 2026 19:44:09 +0000 Subject: [PATCH 2/4] Fix Adventure 5 ClickEvent.Action API compatibility ClickEvent.Action is no longer an enum in Adventure 5 - it's a sealed class hierarchy with static constants. Fix 3 compilation errors: - Settings.java: replace enum values()/name() with NAMES.keys() - CaptionUtility.java: replace enum valueOf() with NAMES.value() lookup - ClickStripTransform.java: replace EnumSet.copyOf with Set.copyOf --- .../java/com/plotsquared/core/configuration/Settings.java | 5 +---- .../core/configuration/caption/CaptionUtility.java | 4 +++- .../core/configuration/caption/ClickStripTransform.java | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java index 67378c450f..6df396b7ce 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java @@ -26,7 +26,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.stream.Collectors; public class Settings extends Config { @@ -519,9 +518,7 @@ public static final class Chat { @Comment({"The click event actions that should be removed from user input in e.g. plot flags like 'greeting'.", "Actions like 'RUN_COMMAND' may be used maliciously as players could trick staff into clicking on messages", "triggering destructive commands."}) - public static List CLICK_EVENT_ACTIONS_TO_REMOVE = Arrays.stream(ClickEvent.Action.values()) - .map(Enum::name) - .collect(Collectors.toList()); + public static List CLICK_EVENT_ACTIONS_TO_REMOVE = new ArrayList<>(ClickEvent.Action.NAMES.keys()); } diff --git a/Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionUtility.java b/Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionUtility.java index 160e3277ab..edba90d94d 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionUtility.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionUtility.java @@ -32,6 +32,7 @@ import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import java.util.Objects; import java.util.Set; import java.util.regex.Pattern; @@ -53,7 +54,8 @@ public class CaptionUtility { private static final ComponentTransform CLICK_STRIP_TRANSFORM = nested( stripClicks( Settings.Chat.CLICK_EVENT_ACTIONS_TO_REMOVE.stream() - .map(ClickEvent.Action::valueOf) + .map(ClickEvent.Action.NAMES::value) + .filter(Objects::nonNull) .toArray(ClickEvent.Action[]::new) ) ); diff --git a/Core/src/main/java/com/plotsquared/core/configuration/caption/ClickStripTransform.java b/Core/src/main/java/com/plotsquared/core/configuration/caption/ClickStripTransform.java index 2ebdf2c875..84f7ca8463 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/caption/ClickStripTransform.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/caption/ClickStripTransform.java @@ -22,7 +22,6 @@ import net.kyori.adventure.text.event.ClickEvent; import org.checkerframework.checker.nullness.qual.NonNull; -import java.util.EnumSet; import java.util.Set; final class ClickStripTransform implements ComponentTransform { @@ -30,7 +29,7 @@ final class ClickStripTransform implements ComponentTransform { private final Set actionsToStrip; public ClickStripTransform(final Set actionsToStrip) { - this.actionsToStrip = EnumSet.copyOf(actionsToStrip); + this.actionsToStrip = Set.copyOf(actionsToStrip); } @Override From e29e4a1ea9698a1f688656313f89c7989d30e47a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 14 Jun 2026 19:53:46 +0000 Subject: [PATCH 3/4] Plan: fix ClickEvent.Action generic typing --- .../configuration/caption/ClickStripTransformTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/src/test/java/com/plotsquared/core/configuration/caption/ClickStripTransformTest.java b/Core/src/test/java/com/plotsquared/core/configuration/caption/ClickStripTransformTest.java index fe87b564ec..c47cd637f4 100644 --- a/Core/src/test/java/com/plotsquared/core/configuration/caption/ClickStripTransformTest.java +++ b/Core/src/test/java/com/plotsquared/core/configuration/caption/ClickStripTransformTest.java @@ -27,7 +27,7 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import java.util.EnumSet; +import java.util.Set; class ClickStripTransformTest { @@ -36,7 +36,7 @@ class ClickStripTransformTest { @DisplayName("Remove click event of specific action correctly") void removeClickEvent() { var commonAction = ClickEvent.Action.OPEN_FILE; - var transform = new ClickStripTransform(EnumSet.of(commonAction)); + var transform = new ClickStripTransform(Set.of(commonAction)); var component = Component.text("Hello").clickEvent(ClickEvent.openFile("World")); var transformedComponent = transform.transform(component); Assertions.assertNull(transformedComponent.clickEvent()); @@ -46,7 +46,7 @@ void removeClickEvent() { @DisplayName("Don't remove click events of other action types") void ignoreClickEvent() { var actionToRemove = ClickEvent.Action.SUGGEST_COMMAND; - var transform = new ClickStripTransform(EnumSet.of(actionToRemove)); + var transform = new ClickStripTransform(Set.of(actionToRemove)); var originalClickEvent = ClickEvent.changePage(1337); var component = Component.text("Hello") .clickEvent(originalClickEvent); @@ -58,7 +58,7 @@ void ignoreClickEvent() { @DisplayName("Remove nested click events correctly") void removeNestedClickEvent() { // nested transform is required to apply on children - var transform = new NestedComponentTransform(new ClickStripTransform(EnumSet.allOf(ClickEvent.Action.class))); + var transform = new NestedComponentTransform(new ClickStripTransform(new java.util.HashSet<>(ClickEvent.Action.NAMES.values()))); var inner = Component // some arbitrary values that should remain .text("World") From 0188dda5730a6d6e7d3dceda00ae6d9a4c06d558 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 14 Jun 2026 19:54:46 +0000 Subject: [PATCH 4/4] Fix Adventure 5 ClickEvent.Action generic types throughout click-strip code - ClickStripTransform: use Set> field and Set> constructor parameter - ComponentTransform: update stripClicks vararg to ClickEvent.Action... with @SafeVarargs - CaptionUtility: replace toArray+stripClicks with Collectors.toUnmodifiableSet() piped directly into ClickStripTransform constructor - ClickStripTransformTest: replace EnumSet.of/allOf with Set.of/NAMES.values() --- .../core/configuration/caption/CaptionUtility.java | 6 +++--- .../core/configuration/caption/ClickStripTransform.java | 4 ++-- .../core/configuration/caption/ComponentTransform.java | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionUtility.java b/Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionUtility.java index edba90d94d..aaa5c60f98 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionUtility.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionUtility.java @@ -35,9 +35,9 @@ import java.util.Objects; import java.util.Set; import java.util.regex.Pattern; +import java.util.stream.Collectors; import static com.plotsquared.core.configuration.caption.ComponentTransform.nested; -import static com.plotsquared.core.configuration.caption.ComponentTransform.stripClicks; public class CaptionUtility { @@ -52,11 +52,11 @@ public class CaptionUtility { ); private static final ComponentTransform CLICK_STRIP_TRANSFORM = nested( - stripClicks( + new ClickStripTransform( Settings.Chat.CLICK_EVENT_ACTIONS_TO_REMOVE.stream() .map(ClickEvent.Action.NAMES::value) .filter(Objects::nonNull) - .toArray(ClickEvent.Action[]::new) + .collect(Collectors.toUnmodifiableSet()) ) ); diff --git a/Core/src/main/java/com/plotsquared/core/configuration/caption/ClickStripTransform.java b/Core/src/main/java/com/plotsquared/core/configuration/caption/ClickStripTransform.java index 84f7ca8463..60af45c46b 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/caption/ClickStripTransform.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/caption/ClickStripTransform.java @@ -26,9 +26,9 @@ final class ClickStripTransform implements ComponentTransform { - private final Set actionsToStrip; + private final Set> actionsToStrip; - public ClickStripTransform(final Set actionsToStrip) { + public ClickStripTransform(final Set> actionsToStrip) { this.actionsToStrip = Set.copyOf(actionsToStrip); } diff --git a/Core/src/main/java/com/plotsquared/core/configuration/caption/ComponentTransform.java b/Core/src/main/java/com/plotsquared/core/configuration/caption/ComponentTransform.java index 27f7b09c5a..fe64160db7 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/caption/ComponentTransform.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/caption/ComponentTransform.java @@ -47,7 +47,8 @@ static ComponentTransform nested(ComponentTransform transform) { * @return a new transform that removes click events from a component. * @since 6.0.10 */ - static ComponentTransform stripClicks(ClickEvent.Action... actionsToRemove) { + @SafeVarargs + static ComponentTransform stripClicks(ClickEvent.Action... actionsToRemove) { return new ClickStripTransform(Set.of(actionsToRemove)); }