Interface TextTranslator

All Known Subinterfaces:
CommonTranslationData, CommonTranslationData.RecordBased, TextTranslator.LocaleBased
All Known Implementing Classes:
CommandTranslationData, CommonTranslationData.Impl, DialogHolder
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface TextTranslator
Converts a Java Component to a Bedrock legacy-formatted String.

Implementations usually do this using the methods available in MessageTranslator, possibly using a player's locale. This interface essentially curries the player's locale (and as such, in many cases, the GeyserSession) outside of the convertMessage method, leading to a simpler signature.

It is planned to expand the usage of this interface in the future, reducing the need to pass a GeyserSession around.

  • Method Details

    • convertText

      String convertText(net.kyori.adventure.text.Component component)
    • forLocale

      static TextTranslator forLocale(String locale)