Fix deprecation in ComponentFactory

This commit is contained in:
Vankka 2024-06-16 14:41:53 +03:00
parent 26c6a909da
commit 76374f49dd
No known key found for this signature in database
GPG Key ID: 62E48025ED4E7EBB

View File

@ -32,6 +32,7 @@ import dev.vankka.mcdiscordreserializer.minecraft.MinecraftSerializer;
import dev.vankka.mcdiscordreserializer.minecraft.MinecraftSerializerOptions; import dev.vankka.mcdiscordreserializer.minecraft.MinecraftSerializerOptions;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TranslatableComponent; import net.kyori.adventure.text.TranslatableComponent;
import net.kyori.adventure.text.TranslationArgument;
import net.kyori.adventure.text.flattener.ComponentFlattener; import net.kyori.adventure.text.flattener.ComponentFlattener;
import net.kyori.adventure.text.serializer.ansi.ANSIComponentSerializer; import net.kyori.adventure.text.serializer.ansi.ANSIComponentSerializer;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
@ -90,10 +91,9 @@ public class ComponentFactory implements MinecraftComponentFactory {
} }
return translation.translate( return translation.translate(
component.args() component.arguments()
.stream() .stream()
.map(discordSerializer::serialize) .map(TranslationArgument::value)
.map(str -> (Object) str)
.toArray(Object[]::new) .toArray(Object[]::new)
); );
} }