diff --git a/annotation-processors/src/main/java/net/kyori/adventure/annotation/processing/SyntheticAnnotationProcessor.java b/annotation-processors/src/main/java/net/kyori/adventure/annotation/processing/SyntheticAnnotationProcessor.java
new file mode 100644
index 0000000000..cb3b8bf91c
--- /dev/null
+++ b/annotation-processors/src/main/java/net/kyori/adventure/annotation/processing/SyntheticAnnotationProcessor.java
@@ -0,0 +1,43 @@
+package net.kyori.adventure.annotation.processing;
+
+import com.google.auto.service.AutoService;
+import java.util.Set;
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.Processor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic;
+import org.jetbrains.annotations.ApiStatus;
+
+/**
+ * Validate that Synthetic annotations are used in tandem with the {@link Deprecated} annotation.
+ *
+ * @since 5.0.0
+ */
+@ApiStatus.Internal
+@AutoService(Processor.class)
+@SupportedAnnotationTypes(SyntheticAnnotationProcessor.ADVENTURE_SYNTHETIC_ANNOTATION)
+public class SyntheticAnnotationProcessor extends AbstractProcessor {
+
+ public static final String ADVENTURE_SYNTHETIC_ANNOTATION = "net.kyori.adventure.internal.Synthetic";
+
+ @Override
+ public boolean process(final Set extends TypeElement> annotations, final RoundEnvironment roundEnv) {
+ for (final TypeElement annotation : annotations) {
+ for (final Element element : roundEnv.getElementsAnnotatedWith(annotation)) {
+ if (element.getAnnotation(Deprecated.class) == null) {
+ this.processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, ADVENTURE_SYNTHETIC_ANNOTATION + " needs to be used together with " + Deprecated.class.getCanonicalName() + ", see Synthetic javadocs", element);
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public SourceVersion getSupportedSourceVersion() {
+ return SourceVersion.latestSupported();
+ }
+}
diff --git a/api/build.gradle.kts b/api/build.gradle.kts
index f2f75db280..0e052452e6 100644
--- a/api/build.gradle.kts
+++ b/api/build.gradle.kts
@@ -1,6 +1,16 @@
+import net.bytebuddy.asm.ModifierAdjustment
+import net.bytebuddy.build.gradle.Adjustment
+import net.bytebuddy.description.method.MethodDescription
+import net.bytebuddy.description.modifier.SyntheticState
+import net.bytebuddy.description.type.TypeDescription
+import net.bytebuddy.dynamic.ClassFileLocator
+import net.bytebuddy.dynamic.DynamicType
+import net.bytebuddy.matcher.ElementMatcher
+
plugins {
id("adventure.common-conventions")
alias(libs.plugins.jmh)
+ alias(libs.plugins.byteBuddy)
}
configurations {
@@ -20,3 +30,40 @@ dependencies {
}
applyJarMetadata("net.kyori.adventure")
+
+class SyntheticPlugin : net.bytebuddy.build.Plugin {
+ private val name = "net.kyori.adventure.internal.Synthetic"
+
+ override fun apply(
+ builder: DynamicType.Builder<*>,
+ typeDescription: TypeDescription,
+ classFileLocator: ClassFileLocator,
+ ): DynamicType.Builder<*> {
+ return builder.visit(
+ ModifierAdjustment()
+ .withMethodModifiers(
+ ElementMatcher { methodDescription: MethodDescription -> methodDescription.declaredAnnotations.any { it.annotationType.name == name } },
+ SyntheticState.SYNTHETIC
+ )
+ )
+ }
+
+ override fun matches(target: TypeDescription): Boolean {
+ return target.declaredMethods.any { method ->
+ method.declaredAnnotations.any { annotation ->
+ annotation.annotationType.name == name
+ }
+ }
+ }
+
+ override fun close() {
+ // Nothing to close!
+ }
+}
+
+byteBuddy {
+ adjustment = Adjustment.SELF
+ transformation {
+ plugin = SyntheticPlugin::class.java
+ }
+}
diff --git a/api/src/main/java/net/kyori/adventure/internal/Synthetic.java b/api/src/main/java/net/kyori/adventure/internal/Synthetic.java
new file mode 100644
index 0000000000..8315c6370a
--- /dev/null
+++ b/api/src/main/java/net/kyori/adventure/internal/Synthetic.java
@@ -0,0 +1,48 @@
+/*
+ * This file is part of adventure, licensed under the MIT License.
+ *
+ * Copyright (c) 2017-2025 KyoriPowered
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package net.kyori.adventure.internal;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.jetbrains.annotations.ApiStatus;
+
+/**
+ * Marks that a method will be transformed to a synthetic method at build time.
+ *
+ *
This is used as a bridge to remove the visibility of methods whilst keeping them
+ * available at runtime for library consumers that have not yet updated to stop using
+ * these old methods.
+ *
+ * Any method with this annotation must also be deprecated and should not be
+ * called from any main, test, or other code.
+ *
+ * @since 5.0.0
+ */
+@ApiStatus.Internal
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.METHOD)
+public @interface Synthetic {
+}
diff --git a/api/src/main/java/net/kyori/adventure/text/Component.java b/api/src/main/java/net/kyori/adventure/text/Component.java
index ec5c46cf02..0f3fbeb426 100644
--- a/api/src/main/java/net/kyori/adventure/text/Component.java
+++ b/api/src/main/java/net/kyori/adventure/text/Component.java
@@ -39,6 +39,7 @@
import java.util.function.UnaryOperator;
import java.util.stream.Collector;
import net.kyori.adventure.builder.AbstractBuilder;
+import net.kyori.adventure.internal.Synthetic;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.event.HoverEvent;
@@ -458,8 +459,11 @@ static KeybindComponent keybind(final KeybindComponent.KeybindLike keybind, fina
* @param color the color
* @return the keybind component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #keybind(String, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static KeybindComponent keybind(final String keybind, final @Nullable TextColor color) {
return keybind(keybind, Style.style(color));
}
@@ -471,8 +475,11 @@ static KeybindComponent keybind(final String keybind, final @Nullable TextColor
* @param color the color
* @return the keybind component
* @since 4.9.0
+ * @deprecated For removal in 6.0.0, use {@link #keybind(KeybindComponent.KeybindLike, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static KeybindComponent keybind(final KeybindComponent.KeybindLike keybind, final @Nullable TextColor color) {
return keybind(requireNonNull(keybind, "keybind").asKeybind(), Style.style(color));
}
@@ -485,8 +492,11 @@ static KeybindComponent keybind(final KeybindComponent.KeybindLike keybind, fina
* @param decorations the decorations
* @return the keybind component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #keybind(String, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static KeybindComponent keybind(final String keybind, final @Nullable TextColor color, final TextDecoration... decorations) {
return keybind(keybind, Style.style(color, decorations));
}
@@ -499,8 +509,11 @@ static KeybindComponent keybind(final String keybind, final @Nullable TextColor
* @param decorations the decorations
* @return the keybind component
* @since 4.9.0
+ * @deprecated For removal in 6.0.0, use {@link #keybind(KeybindComponent.KeybindLike, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static KeybindComponent keybind(final KeybindComponent.KeybindLike keybind, final @Nullable TextColor color, final TextDecoration... decorations) {
return keybind(requireNonNull(keybind, "keybind").asKeybind(), Style.style(color, decorations));
}
@@ -513,8 +526,11 @@ static KeybindComponent keybind(final KeybindComponent.KeybindLike keybind, fina
* @param decorations the decorations
* @return the keybind component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #keybind(String, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static KeybindComponent keybind(final String keybind, final @Nullable TextColor color, final Set decorations) {
return keybind(keybind, Style.style(color, decorations));
}
@@ -527,12 +543,41 @@ static KeybindComponent keybind(final String keybind, final @Nullable TextColor
* @param decorations the decorations
* @return the keybind component
* @since 4.9.0
+ * @deprecated For removal in 6.0.0, use {@link #keybind(KeybindComponent.KeybindLike, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static KeybindComponent keybind(final KeybindComponent.KeybindLike keybind, final @Nullable TextColor color, final Set decorations) {
return keybind(requireNonNull(keybind, "keybind").asKeybind(), Style.style(color, decorations));
}
+ /**
+ * Creates a keybind component with a keybind, and optional style builder applicables (e.g., color, decoration).
+ *
+ * @param keybind the keybind
+ * @param applicables the style builder applicables
+ * @return the keybind component
+ * @since 5.0.0
+ */
+ @Contract(value = "_, _ -> new", pure = true)
+ static KeybindComponent keybind(final String keybind, final StyleBuilderApplicable... applicables) {
+ return keybind(requireNonNull(keybind, "keybind"), Style.style(applicables));
+ }
+
+ /**
+ * Creates a keybind component with a keybind, and optional style builder applicables (e.g., color, decoration).
+ *
+ * @param keybind the keybind
+ * @param applicables the style builder applicables
+ * @return the keybind component
+ * @since 5.0.0
+ */
+ @Contract(value = "_, _ -> new", pure = true)
+ static KeybindComponent keybind(final KeybindComponent.KeybindLike keybind, final StyleBuilderApplicable... applicables) {
+ return keybind(requireNonNull(keybind, "keybind").asKeybind(), Style.style(applicables));
+ }
+
/*
* -------------------------
* ---- ObjectComponent ----
@@ -824,6 +869,19 @@ static TextComponent text(final String content, final Style style) {
return TextComponentImpl.create(Collections.emptyList(), requireNonNull(style, "style"), content);
}
+ /**
+ * Creates a text component with content and styling.
+ *
+ * @param content the plain text content
+ * @param applicables the style builder applicables
+ * @return a text component
+ * @since 5.0.0
+ */
+ @Contract(value = "_, _ -> new", pure = true)
+ static TextComponent text(final String content, final StyleBuilderApplicable... applicables) {
+ return TextComponentImpl.create(Collections.emptyList(), Style.style(applicables), content);
+ }
+
/**
* Creates a text component with content, and optional color.
*
@@ -831,8 +889,11 @@ static TextComponent text(final String content, final Style style) {
* @param color the color
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(String, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final String content, final @Nullable TextColor color) {
return text(content, Style.style(color));
}
@@ -845,8 +906,11 @@ static TextComponent text(final String content, final @Nullable TextColor color)
* @param decorations the decorations
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(String, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final String content, final @Nullable TextColor color, final TextDecoration... decorations) {
return text(content, Style.style(color, decorations));
}
@@ -859,8 +923,11 @@ static TextComponent text(final String content, final @Nullable TextColor color,
* @param decorations the decorations
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(String, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final String content, final @Nullable TextColor color, final Set decorations) {
return text(content, Style.style(color, decorations));
}
@@ -890,6 +957,19 @@ static TextComponent text(final boolean value, final Style style) {
return text(String.valueOf(value), style);
}
+ /**
+ * Creates a text component with the content of {@link String#valueOf(boolean)} and styling.
+ *
+ * @param value the boolean value
+ * @param applicables the style builder applicables
+ * @return a text component
+ * @since 5.0.0
+ */
+ @Contract(value = "_, _ -> new", pure = true)
+ static TextComponent text(final boolean value, final StyleBuilderApplicable... applicables) {
+ return text(String.valueOf(value), Style.style(applicables));
+ }
+
/**
* Creates a text component with the content of {@link String#valueOf(boolean)}, and optional color.
*
@@ -897,8 +977,11 @@ static TextComponent text(final boolean value, final Style style) {
* @param color the color
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(boolean, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final boolean value, final @Nullable TextColor color) {
return text(String.valueOf(value), color);
}
@@ -911,8 +994,11 @@ static TextComponent text(final boolean value, final @Nullable TextColor color)
* @param decorations the decorations
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(boolean, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final boolean value, final @Nullable TextColor color, final TextDecoration... decorations) {
return text(String.valueOf(value), color, decorations);
}
@@ -925,8 +1011,11 @@ static TextComponent text(final boolean value, final @Nullable TextColor color,
* @param decorations the decorations
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(boolean, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final boolean value, final @Nullable TextColor color, final Set decorations) {
return text(String.valueOf(value), color, decorations);
}
@@ -958,6 +1047,19 @@ static TextComponent text(final char value, final Style style) {
return text(String.valueOf(value), style);
}
+ /**
+ * Creates a text component with the content of {@link String#valueOf(char)} and styling.
+ *
+ * @param value the boolean value
+ * @param applicables the style builder applicables
+ * @return a text component
+ * @since 5.0.0
+ */
+ @Contract(value = "_, _ -> new", pure = true)
+ static TextComponent text(final char value, final StyleBuilderApplicable... applicables) {
+ return text(String.valueOf(value), Style.style(applicables));
+ }
+
/**
* Creates a text component with the content of {@link String#valueOf(char)}, and optional color.
*
@@ -965,8 +1067,11 @@ static TextComponent text(final char value, final Style style) {
* @param color the color
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(char, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final char value, final @Nullable TextColor color) {
return text(String.valueOf(value), color);
}
@@ -979,8 +1084,11 @@ static TextComponent text(final char value, final @Nullable TextColor color) {
* @param decorations the decorations
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(char, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final char value, final @Nullable TextColor color, final TextDecoration... decorations) {
return text(String.valueOf(value), color, decorations);
}
@@ -993,8 +1101,11 @@ static TextComponent text(final char value, final @Nullable TextColor color, fin
* @param decorations the decorations
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(char, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final char value, final @Nullable TextColor color, final Set decorations) {
return text(String.valueOf(value), color, decorations);
}
@@ -1024,6 +1135,19 @@ static TextComponent text(final double value, final Style style) {
return text(String.valueOf(value), style);
}
+ /**
+ * Creates a text component with the content of {@link String#valueOf(double)} and styling.
+ *
+ * @param value the boolean value
+ * @param applicables the style builder applicables
+ * @return a text component
+ * @since 5.0.0
+ */
+ @Contract(value = "_, _ -> new", pure = true)
+ static TextComponent text(final double value, final StyleBuilderApplicable... applicables) {
+ return text(String.valueOf(value), Style.style(applicables));
+ }
+
/**
* Creates a text component with the content of {@link String#valueOf(double)}, and optional color.
*
@@ -1031,8 +1155,11 @@ static TextComponent text(final double value, final Style style) {
* @param color the color
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(double, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final double value, final @Nullable TextColor color) {
return text(String.valueOf(value), color);
}
@@ -1045,8 +1172,11 @@ static TextComponent text(final double value, final @Nullable TextColor color) {
* @param decorations the decorations
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(double, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final double value, final @Nullable TextColor color, final TextDecoration... decorations) {
return text(String.valueOf(value), color, decorations);
}
@@ -1059,8 +1189,11 @@ static TextComponent text(final double value, final @Nullable TextColor color, f
* @param decorations the decorations
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(double, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final double value, final @Nullable TextColor color, final Set decorations) {
return text(String.valueOf(value), color, decorations);
}
@@ -1090,6 +1223,19 @@ static TextComponent text(final float value, final Style style) {
return text(String.valueOf(value), style);
}
+ /**
+ * Creates a text component with the content of {@link String#valueOf(double)} and styling.
+ *
+ * @param value the boolean value
+ * @param applicables the style builder applicables
+ * @return a text component
+ * @since 5.0.0
+ */
+ @Contract(value = "_, _ -> new", pure = true)
+ static TextComponent text(final float value, final StyleBuilderApplicable... applicables) {
+ return text(String.valueOf(value), Style.style(applicables));
+ }
+
/**
* Creates a text component with the content of {@link String#valueOf(float)}, and optional color.
*
@@ -1097,8 +1243,11 @@ static TextComponent text(final float value, final Style style) {
* @param color the color
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(float, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final float value, final @Nullable TextColor color) {
return text(String.valueOf(value), color);
}
@@ -1111,8 +1260,11 @@ static TextComponent text(final float value, final @Nullable TextColor color) {
* @param decorations the decorations
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(float, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final float value, final @Nullable TextColor color, final TextDecoration... decorations) {
return text(String.valueOf(value), color, decorations);
}
@@ -1125,8 +1277,11 @@ static TextComponent text(final float value, final @Nullable TextColor color, fi
* @param decorations the decorations
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(float, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final float value, final @Nullable TextColor color, final Set decorations) {
return text(String.valueOf(value), color, decorations);
}
@@ -1156,6 +1311,19 @@ static TextComponent text(final int value, final Style style) {
return text(String.valueOf(value), style);
}
+ /**
+ * Creates a text component with the content of {@link String#valueOf(int)} and styling.
+ *
+ * @param value the boolean value
+ * @param applicables the style builder applicables
+ * @return a text component
+ * @since 5.0.0
+ */
+ @Contract(value = "_, _ -> new", pure = true)
+ static TextComponent text(final int value, final StyleBuilderApplicable... applicables) {
+ return text(String.valueOf(value), Style.style(applicables));
+ }
+
/**
* Creates a text component with the content of {@link String#valueOf(int)}, and optional color.
*
@@ -1163,8 +1331,11 @@ static TextComponent text(final int value, final Style style) {
* @param color the color
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(int, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final int value, final @Nullable TextColor color) {
return text(String.valueOf(value), color);
}
@@ -1177,8 +1348,11 @@ static TextComponent text(final int value, final @Nullable TextColor color) {
* @param decorations the decorations
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(int, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final int value, final @Nullable TextColor color, final TextDecoration... decorations) {
return text(String.valueOf(value), color, decorations);
}
@@ -1191,8 +1365,11 @@ static TextComponent text(final int value, final @Nullable TextColor color, fina
* @param decorations the decorations
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(int, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final int value, final @Nullable TextColor color, final Set decorations) {
return text(String.valueOf(value), color, decorations);
}
@@ -1222,6 +1399,19 @@ static TextComponent text(final long value, final Style style) {
return text(String.valueOf(value), style);
}
+ /**
+ * Creates a text component with the content of {@link String#valueOf(long)} and styling.
+ *
+ * @param value the boolean value
+ * @param applicables the style builder applicables
+ * @return a text component
+ * @since 5.0.0
+ */
+ @Contract(value = "_, _ -> new", pure = true)
+ static TextComponent text(final long value, final StyleBuilderApplicable... applicables) {
+ return text(String.valueOf(value), Style.style(applicables));
+ }
+
/**
* Creates a text component with the content of {@link String#valueOf(long)}, and optional color.
*
@@ -1229,8 +1419,11 @@ static TextComponent text(final long value, final Style style) {
* @param color the color
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(long, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final long value, final @Nullable TextColor color) {
return text(String.valueOf(value), color);
}
@@ -1243,8 +1436,11 @@ static TextComponent text(final long value, final @Nullable TextColor color) {
* @param decorations the decorations
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(long, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final long value, final @Nullable TextColor color, final TextDecoration... decorations) {
return text(String.valueOf(value), color, decorations);
}
@@ -1257,8 +1453,11 @@ static TextComponent text(final long value, final @Nullable TextColor color, fin
* @param decorations the decorations
* @return a text component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #text(long, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TextComponent text(final long value, final @Nullable TextColor color, final Set decorations) {
return text(String.valueOf(value), color, decorations);
}
@@ -1668,12 +1867,28 @@ static TranslatableComponent translatable(final Translatable translatable, final
* @param color the color
* @return a translatable component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #translatable(String, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TranslatableComponent translatable(final String key, final @Nullable TextColor color) {
return translatable(key, Style.style(color));
}
+ /**
+ * Creates a translatable component with a translation key, and styling.
+ *
+ * @param key the translation key
+ * @param applicables the style builder applicables
+ * @return a translatable component
+ * @since 5.0.0
+ */
+ @Contract(value = "_, _ -> new", pure = true)
+ static TranslatableComponent translatable(final String key, final StyleBuilderApplicable... applicables) {
+ return translatable(key, Style.style(applicables));
+ }
+
/**
* Creates a translatable component with a translation key, and optional color.
*
@@ -1681,12 +1896,28 @@ static TranslatableComponent translatable(final String key, final @Nullable Text
* @param color the color
* @return a translatable component
* @since 4.8.0
+ * @deprecated For removal in 6.0.0, use {@link #translatable(Translatable, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TranslatableComponent translatable(final Translatable translatable, final @Nullable TextColor color) {
return translatable(requireNonNull(translatable, "translatable").translationKey(), color);
}
+ /**
+ * Creates a translatable component with a translation key, and styling.
+ *
+ * @param translatable the translatable object to get the key from
+ * @param applicables the style builder applicables
+ * @return a translatable component
+ * @since 5.0.0
+ */
+ @Contract(value = "_, _ -> new", pure = true)
+ static TranslatableComponent translatable(final Translatable translatable, final StyleBuilderApplicable... applicables) {
+ return translatable(translatable, Style.style(applicables));
+ }
+
/**
* Creates a translatable component with a translation key, and optional color and decorations.
*
@@ -1695,8 +1926,11 @@ static TranslatableComponent translatable(final Translatable translatable, final
* @param decorations the decorations
* @return a translatable component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #translatable(String, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TranslatableComponent translatable(final String key, final @Nullable TextColor color, final TextDecoration... decorations) {
return translatable(key, Style.style(color, decorations));
}
@@ -1709,8 +1943,11 @@ static TranslatableComponent translatable(final String key, final @Nullable Text
* @param decorations the decorations
* @return a translatable component
* @since 4.8.0
+ * @deprecated For removal in 6.0.0, use {@link #translatable(Translatable, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TranslatableComponent translatable(final Translatable translatable, final @Nullable TextColor color, final TextDecoration... decorations) {
return translatable(requireNonNull(translatable, "translatable").translationKey(), color, decorations);
}
@@ -1723,8 +1960,11 @@ static TranslatableComponent translatable(final Translatable translatable, final
* @param decorations the decorations
* @return a translatable component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #translatable(String, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TranslatableComponent translatable(final String key, final @Nullable TextColor color, final Set decorations) {
return translatable(key, Style.style(color, decorations));
}
@@ -1737,8 +1977,11 @@ static TranslatableComponent translatable(final String key, final @Nullable Text
* @param decorations the decorations
* @return a translatable component
* @since 4.8.0
+ * @deprecated For removal in 6.0.0, use {@link #translatable(Translatable, StyleBuilderApplicable...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
+ @Synthetic
static TranslatableComponent translatable(final Translatable translatable, final @Nullable TextColor color, final Set decorations) {
return translatable(requireNonNull(translatable, "translatable").translationKey(), color, decorations);
}
@@ -1805,8 +2048,10 @@ static TranslatableComponent translatable(final Translatable translatable, final
* @param args the translation arguments
* @return a translatable component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #translatable(String, Style, ComponentLike...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
static TranslatableComponent translatable(final String key, final @Nullable TextColor color, final ComponentLike... args) {
return translatable(key, Style.style(color), args);
}
@@ -1819,8 +2064,10 @@ static TranslatableComponent translatable(final String key, final @Nullable Text
* @param args the translation arguments
* @return a translatable component
* @since 4.8.0
+ * @deprecated For removal in 6.0.0, use {@link #translatable(Translatable, Style, ComponentLike...)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
static TranslatableComponent translatable(final Translatable translatable, final @Nullable TextColor color, final ComponentLike... args) {
return translatable(requireNonNull(translatable, "translatable").translationKey(), color, args);
}
@@ -1834,8 +2081,10 @@ static TranslatableComponent translatable(final Translatable translatable, final
* @param args the translation arguments
* @return a translatable component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #translatable(String, Style, ComponentLike...)} instead.
*/
@Contract(value = "_, _, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
static TranslatableComponent translatable(final String key, final @Nullable TextColor color, final Set decorations, final ComponentLike... args) {
return translatable(key, Style.style(color, decorations), args);
}
@@ -1849,8 +2098,10 @@ static TranslatableComponent translatable(final String key, final @Nullable Text
* @param args the translation arguments
* @return a translatable component
* @since 4.8.0
+ * @deprecated For removal in 6.0.0, use {@link #translatable(Translatable, Style, ComponentLike...)} instead.
*/
@Contract(value = "_, _, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
static TranslatableComponent translatable(final Translatable translatable, final @Nullable TextColor color, final Set decorations, final ComponentLike... args) {
return translatable(requireNonNull(translatable, "translatable").translationKey(), color, decorations, args);
}
@@ -1917,8 +2168,10 @@ static TranslatableComponent translatable(final Translatable translatable, final
* @param args the translation arguments
* @return a translatable component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #translatable(String, Style, List)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
static TranslatableComponent translatable(final String key, final @Nullable TextColor color, final List extends ComponentLike> args) {
return translatable(key, Style.style(color), args);
}
@@ -1931,8 +2184,10 @@ static TranslatableComponent translatable(final String key, final @Nullable Text
* @param args the translation arguments
* @return a translatable component
* @since 4.8.0
+ * @deprecated For removal in 6.0.0, use {@link #translatable(Translatable, Style, List)} instead.
*/
@Contract(value = "_, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
static TranslatableComponent translatable(final Translatable translatable, final @Nullable TextColor color, final List extends ComponentLike> args) {
return translatable(requireNonNull(translatable, "translatable").translationKey(), color, args);
}
@@ -1946,8 +2201,10 @@ static TranslatableComponent translatable(final Translatable translatable, final
* @param args the translation arguments
* @return a translatable component
* @since 4.0.0
+ * @deprecated For removal in 6.0.0, use {@link #translatable(String, Style, List)} instead.
*/
@Contract(value = "_, _, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
static TranslatableComponent translatable(final String key, final @Nullable TextColor color, final Set decorations, final List extends ComponentLike> args) {
return translatable(key, Style.style(color, decorations), args);
}
@@ -1961,8 +2218,10 @@ static TranslatableComponent translatable(final String key, final @Nullable Text
* @param args the translation arguments
* @return a translatable component
* @since 4.8.0
+ * @deprecated For removal in 6.0.0, use {@link #translatable(Translatable, Style, List)} instead.
*/
@Contract(value = "_, _, _, _ -> new", pure = true)
+ @Deprecated(forRemoval = true, since = "5.0.0")
static TranslatableComponent translatable(final Translatable translatable, final @Nullable TextColor color, final Set decorations, final List extends ComponentLike> args) {
return translatable(requireNonNull(translatable, "translatable").translationKey(), color, decorations, args);
}
@@ -2016,7 +2275,7 @@ default boolean contains(final Component that, final BiPredicate super Compone
for (final Component child : this.children()) {
if (child.contains(that, equals)) return true;
}
- final @Nullable HoverEvent> hoverEvent = this.hoverEvent();
+ final HoverEvent> hoverEvent = this.hoverEvent();
if (hoverEvent != null) {
final Object value = hoverEvent.value();
Component component = null;
diff --git a/api/src/test/java/net/kyori/adventure/text/AbstractComponentTest.java b/api/src/test/java/net/kyori/adventure/text/AbstractComponentTest.java
index d47308b214..9d778bfc85 100644
--- a/api/src/test/java/net/kyori/adventure/text/AbstractComponentTest.java
+++ b/api/src/test/java/net/kyori/adventure/text/AbstractComponentTest.java
@@ -34,6 +34,7 @@
import net.kyori.adventure.text.event.HoverEvent;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.Style;
+import net.kyori.adventure.text.format.StyleBuilderApplicable;
import net.kyori.adventure.text.format.TextDecoration;
import org.junit.jupiter.api.Test;
@@ -190,7 +191,7 @@ void testMergeStyle_color() {
assertNull(c0.color());
TextAssertions.assertDecorations(c0, ImmutableSet.of(), ImmutableSet.of());
assertNull(c0.clickEvent());
- final C c1 = c0.mergeStyle(Component.text("xyz", NamedTextColor.RED, ImmutableSet.of(TextDecoration.BOLD)).clickEvent(ClickEvent.runCommand("/foo")), Collections.singleton(Style.Merge.COLOR));
+ final C c1 = c0.mergeStyle(Component.text("xyz", (StyleBuilderApplicable) NamedTextColor.RED, TextDecoration.BOLD).clickEvent(ClickEvent.runCommand("/foo")), Collections.singleton(Style.Merge.COLOR));
assertEquals(NamedTextColor.RED, c1.color());
TextAssertions.assertDecorations(c1, ImmutableSet.of(), ImmutableSet.of());
assertNull(c1.clickEvent());
@@ -203,7 +204,7 @@ void testMergeStyle_decorations() {
assertNull(c0.color());
TextAssertions.assertDecorations(c0, ImmutableSet.of(), ImmutableSet.of());
assertNull(c0.clickEvent());
- final C c1 = c0.mergeStyle(Component.text("xyz", NamedTextColor.RED, ImmutableSet.of(TextDecoration.BOLD)).clickEvent(ClickEvent.runCommand("/foo")), Collections.singleton(Style.Merge.DECORATIONS));
+ final C c1 = c0.mergeStyle(Component.text("xyz", (StyleBuilderApplicable) NamedTextColor.RED, TextDecoration.BOLD).clickEvent(ClickEvent.runCommand("/foo")), Collections.singleton(Style.Merge.DECORATIONS));
assertNull(c1.color());
TextAssertions.assertDecorations(c1, ImmutableSet.of(TextDecoration.BOLD), ImmutableSet.of());
assertNull(c1.clickEvent());
@@ -216,7 +217,7 @@ void testMergeStyle_events() {
assertNull(c0.color());
TextAssertions.assertDecorations(c0, ImmutableSet.of(), ImmutableSet.of());
assertNull(c0.clickEvent());
- final C c1 = c0.mergeStyle(Component.text("xyz", NamedTextColor.RED, ImmutableSet.of(TextDecoration.BOLD)).clickEvent(ClickEvent.runCommand("/foo")), Collections.singleton(Style.Merge.EVENTS));
+ final C c1 = c0.mergeStyle(Component.text("xyz", (StyleBuilderApplicable) NamedTextColor.RED, TextDecoration.BOLD).clickEvent(ClickEvent.runCommand("/foo")), Collections.singleton(Style.Merge.EVENTS));
assertNull(c1.color());
TextAssertions.assertDecorations(c1, ImmutableSet.of(), ImmutableSet.of());
assertNotNull(c1.clickEvent());
@@ -228,7 +229,7 @@ void testSetStyle() {
assertNull(c0.color());
TextAssertions.assertDecorations(c0, ImmutableSet.of(), ImmutableSet.of());
assertNull(c0.clickEvent());
- final C c1 = c0.style(Component.text("xyz", NamedTextColor.RED, ImmutableSet.of(TextDecoration.BOLD)).clickEvent(ClickEvent.runCommand("/foo")).style());
+ final C c1 = c0.style(Component.text("xyz", (StyleBuilderApplicable) NamedTextColor.RED, TextDecoration.BOLD).clickEvent(ClickEvent.runCommand("/foo")).style());
assertEquals(NamedTextColor.RED, c1.color());
TextAssertions.assertDecorations(c1, ImmutableSet.of(TextDecoration.BOLD), ImmutableSet.of());
assertNotNull(c1.clickEvent());
@@ -331,8 +332,8 @@ void testBasicEquals() {
@Test
void testBuilderApplyDeep() {
final C c0 = this.builder()
- .append(Component.text("a", NamedTextColor.RED))
- .append(Component.text("b", NamedTextColor.RED))
+ .append(Component.text("a", (StyleBuilderApplicable) NamedTextColor.RED))
+ .append(Component.text("b", (StyleBuilderApplicable) NamedTextColor.RED))
.applyDeep(builder -> builder.color(NamedTextColor.GREEN))
.build();
final List children = c0.children();
@@ -345,11 +346,11 @@ void testBuilderApplyDeep() {
@Test
void testCollectorNoSeparator() {
final Component joined = Stream.of(
- Component.text("Hello", NamedTextColor.RED),
+ Component.text("Hello", (StyleBuilderApplicable) NamedTextColor.RED),
Component.text("World")
).collect(Component.toComponent());
final Component expected = Component.text()
- .append(Component.text("Hello", NamedTextColor.RED))
+ .append(Component.text("Hello", (StyleBuilderApplicable) NamedTextColor.RED))
.append(Component.text("World"))
.build();
@@ -359,12 +360,12 @@ void testCollectorNoSeparator() {
@Test
void testCollectorWithSeparator() {
final Component joined = Stream.of(
- Component.text("Hello", NamedTextColor.RED),
+ Component.text("Hello", (StyleBuilderApplicable) NamedTextColor.RED),
Component.text("World")
).collect(Component.toComponent(Component.space()));
final Component expected = Component.text()
- .append(Component.text("Hello", NamedTextColor.RED))
+ .append(Component.text("Hello", (StyleBuilderApplicable) NamedTextColor.RED))
.append(Component.space())
.append(Component.text("World"))
.build();
diff --git a/api/src/test/java/net/kyori/adventure/text/KeybindComponentTest.java b/api/src/test/java/net/kyori/adventure/text/KeybindComponentTest.java
index a9c1a7b31a..b9dcfd5ef2 100644
--- a/api/src/test/java/net/kyori/adventure/text/KeybindComponentTest.java
+++ b/api/src/test/java/net/kyori/adventure/text/KeybindComponentTest.java
@@ -25,6 +25,7 @@
import com.google.common.collect.ImmutableSet;
import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.format.StyleBuilderApplicable;
import net.kyori.adventure.text.format.TextDecoration;
import org.junit.jupiter.api.Test;
@@ -47,7 +48,7 @@ void testOf() {
@Test
void testOf_color() {
- final KeybindComponent component = Component.keybind("key.jump", NamedTextColor.GREEN);
+ final KeybindComponent component = Component.keybind("key.jump", (StyleBuilderApplicable) NamedTextColor.GREEN);
assertEquals("key.jump", component.keybind());
assertEquals(NamedTextColor.GREEN, component.color());
TextAssertions.assertDecorations(component, ImmutableSet.of(), ImmutableSet.of());
@@ -55,7 +56,7 @@ void testOf_color() {
@Test
void testOf_color_decorations() {
- final KeybindComponent component = Component.keybind("key.jump", NamedTextColor.GREEN, ImmutableSet.of(TextDecoration.BOLD));
+ final KeybindComponent component = Component.keybind("key.jump", (StyleBuilderApplicable) NamedTextColor.GREEN, TextDecoration.BOLD);
assertEquals("key.jump", component.keybind());
assertEquals(NamedTextColor.GREEN, component.color());
TextAssertions.assertDecorations(component, ImmutableSet.of(TextDecoration.BOLD), ImmutableSet.of());
diff --git a/api/src/test/java/net/kyori/adventure/text/TextComponentTest.java b/api/src/test/java/net/kyori/adventure/text/TextComponentTest.java
index 757701315a..e1d127c54a 100644
--- a/api/src/test/java/net/kyori/adventure/text/TextComponentTest.java
+++ b/api/src/test/java/net/kyori/adventure/text/TextComponentTest.java
@@ -28,6 +28,7 @@
import java.util.Collections;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.Style;
+import net.kyori.adventure.text.format.StyleBuilderApplicable;
import net.kyori.adventure.text.format.TextColor;
import net.kyori.adventure.text.format.TextDecoration;
import org.junit.jupiter.api.Test;
@@ -89,13 +90,11 @@ void testOfSameResult() {
new EqualsTester()
.addEqualityGroup(
Component.text("foo", Style.style(TextColor.color(0x0a1ab9))),
- Component.text("foo", TextColor.color(0x0a1ab9)),
- Component.text("foo", TextColor.color(0x0a1ab9), ImmutableSet.of())
+ Component.text("foo", (StyleBuilderApplicable) TextColor.color(0x0a1ab9))
)
.addEqualityGroup(
Component.text("foo", Style.style(TextColor.color(0x0a1ab9), TextDecoration.BOLD)),
- Component.text("foo", TextColor.color(0x0a1ab9), TextDecoration.BOLD),
- Component.text("foo", TextColor.color(0x0a1ab9), ImmutableSet.of(TextDecoration.BOLD))
+ Component.text("foo", (StyleBuilderApplicable) TextColor.color(0x0a1ab9), TextDecoration.BOLD)
)
.testEquals();
}
@@ -108,7 +107,7 @@ void testOfKnownChar() {
@Test
void testOf_color() {
- final TextComponent component = Component.text("foo", NamedTextColor.GREEN);
+ final TextComponent component = Component.text("foo", (StyleBuilderApplicable) NamedTextColor.GREEN);
assertEquals("foo", component.content());
assertEquals(NamedTextColor.GREEN, component.color());
assertDecorations(component, ImmutableSet.of(), ImmutableSet.of());
@@ -116,7 +115,7 @@ void testOf_color() {
@Test
void testOf_color_decorations() {
- final TextComponent component = Component.text("foo", NamedTextColor.GREEN, ImmutableSet.of(TextDecoration.BOLD));
+ final TextComponent component = Component.text("foo", (StyleBuilderApplicable) NamedTextColor.GREEN, TextDecoration.BOLD);
assertEquals("foo", component.content());
assertEquals(NamedTextColor.GREEN, component.color());
assertDecorations(component, ImmutableSet.of(TextDecoration.BOLD), ImmutableSet.of());
diff --git a/api/src/test/java/net/kyori/adventure/text/TranslatableComponentTest.java b/api/src/test/java/net/kyori/adventure/text/TranslatableComponentTest.java
index b38ae8b75e..f7980d7d13 100644
--- a/api/src/test/java/net/kyori/adventure/text/TranslatableComponentTest.java
+++ b/api/src/test/java/net/kyori/adventure/text/TranslatableComponentTest.java
@@ -26,6 +26,7 @@
import com.google.common.collect.ImmutableSet;
import java.util.Collections;
import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.format.StyleBuilderApplicable;
import net.kyori.adventure.text.format.TextDecoration;
import org.junit.jupiter.api.Test;
@@ -51,7 +52,7 @@ void testOf() {
@Test
void testOf_color() {
- final TranslatableComponent component = Component.translatable("multiplayer.player.left", NamedTextColor.GREEN);
+ final TranslatableComponent component = Component.translatable("multiplayer.player.left", (StyleBuilderApplicable) NamedTextColor.GREEN);
assertEquals("multiplayer.player.left", component.key());
assertEquals(NamedTextColor.GREEN, component.color());
assertDecorations(component, ImmutableSet.of(), ImmutableSet.of());
@@ -59,8 +60,8 @@ void testOf_color() {
@Test
void testOf_color_decorations() {
- final TranslatableComponent c0 = Component.translatable("multiplayer.player.left", NamedTextColor.GREEN, TextDecoration.BOLD);
- final TranslatableComponent c1 = Component.translatable("multiplayer.player.left", NamedTextColor.GREEN, ImmutableSet.of(TextDecoration.BOLD));
+ final TranslatableComponent c0 = Component.translatable("multiplayer.player.left", (StyleBuilderApplicable) NamedTextColor.GREEN, TextDecoration.BOLD);
+ final TranslatableComponent c1 = Component.translatable("multiplayer.player.left", (StyleBuilderApplicable) NamedTextColor.GREEN, TextDecoration.BOLD);
assertEquals("multiplayer.player.left", c1.key());
assertEquals(NamedTextColor.GREEN, c0.color());
assertEquals(NamedTextColor.GREEN, c1.color());
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index e6c1dc1262..ca3cf26112 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -69,3 +69,4 @@ zJmh = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmh" }
indra-sonatype = { id = "net.kyori.indra.publishing.sonatype", version.ref = "indra" }
jmh = { id = "me.champeau.jmh", version.ref = "jmhPlugin" }
nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" }
+byteBuddy = "net.bytebuddy.byte-buddy-gradle-plugin:1.17.8"