All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.minestom.server.adventure.provider.MinestomGsonComponentSerializerProvider Maven / Gradle / Ivy

There is a newer version: lib-module-20989dc8ad
Show newest version
package net.minestom.server.adventure.provider;

import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import org.jetbrains.annotations.NotNull;

import java.util.function.Consumer;

@SuppressWarnings("UnstableApiUsage") // we are permitted to provide this
public final class MinestomGsonComponentSerializerProvider implements GsonComponentSerializer.Provider {
    @Override
    public @NotNull GsonComponentSerializer gson() {
        return GsonComponentSerializer.builder()
                .legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.INSTANCE)
                .build();
    }

    @Override
    public @NotNull GsonComponentSerializer gsonLegacy() {
        return GsonComponentSerializer.builder()
                .legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.INSTANCE)
                .downsampleColors()
                .build();
    }

    @Override
    public @NotNull Consumer builder() {
        return builder -> {}; // we don't need to touch the builder here
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy