net.minestom.server.adventure.provider.MinestomComponentLoggerProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of minestom-snapshots Show documentation
Show all versions of minestom-snapshots Show documentation
1.20.4 Lightweight Minecraft server
package net.minestom.server.adventure.provider;
import net.kyori.adventure.text.logger.slf4j.ComponentLogger;
import net.kyori.adventure.text.logger.slf4j.ComponentLoggerProvider;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.jetbrains.annotations.NotNull;
import org.slf4j.LoggerFactory;
@SuppressWarnings("UnstableApiUsage") // we are permitted to provide this
public class MinestomComponentLoggerProvider implements ComponentLoggerProvider {
private static final LegacyComponentSerializer SERIALIZER = LegacyComponentSerializer.builder()
.character(LegacyComponentSerializer.SECTION_CHAR)
.flattener(MinestomFlattenerProvider.INSTANCE)
.hexColors()
.build();
@Override
public @NotNull ComponentLogger logger(@NotNull LoggerHelper helper, @NotNull String name) {
return helper.delegating(LoggerFactory.getLogger(name), SERIALIZER::serialize);
}
}