diff --git a/paper-server/src/main/java/io/papermc/paper/adventure/AdventureCodecs.java b/paper-server/src/main/java/io/papermc/paper/adventure/AdventureCodecs.java index 85fc3b5c6e..af71050196 100644 --- a/paper-server/src/main/java/io/papermc/paper/adventure/AdventureCodecs.java +++ b/paper-server/src/main/java/io/papermc/paper/adventure/AdventureCodecs.java @@ -79,10 +79,7 @@ public final class AdventureCodecs { public static final Codec COMPONENT_CODEC = recursive("adventure Component", AdventureCodecs::createCodec); public static final StreamCodec STREAM_COMPONENT_CODEC = ByteBufCodecs.fromCodecWithRegistriesTrusted(COMPONENT_CODEC); - static final Codec SHADOW_COLOR_CODEC = Codec.INT.comapFlatMap(s -> { - @Nullable ShadowColor value = ShadowColor.shadowColor(s); - return value != null ? DataResult.success(value) : DataResult.error(() -> "Cannot convert " + s + " to adventure ShadowColor"); - }, ShadowColor::value); + static final Codec SHADOW_COLOR_CODEC = Codec.INT.xmap(ShadowColor::shadowColor, ShadowColor::value); static final Codec TEXT_COLOR_CODEC = Codec.STRING.comapFlatMap(s -> { if (s.startsWith("#")) { @@ -225,6 +222,7 @@ public final class AdventureCodecs { public static final MapCodec