Class PlayerLocaleFetcher

java.lang.Object
de.marcely.bedwars.api.message.PlayerLocaleFetcher

public abstract class PlayerLocaleFetcher extends Object
Used to fetch the locale of a player.
See Also:
  • Constructor Details

    • PlayerLocaleFetcher

      public PlayerLocaleFetcher()
  • Method Details

    • getPlugin

      public abstract Plugin getPlugin()
      Returns the plugin that's owning this instance
      Returns:
      The plugin that created this instance
    • isDefault

      public final boolean isDefault()
      Returns if it's the PlayerLocaleFetcher provided by MBedwars
      Returns:
      true if it's the PlayerLocaleFetcher provided by MBedwars
    • fetch

      @Nullable public abstract @Nullable Locale fetch(Player player)
      Fetches the locale of a player.

      The default configured locale will be used if null is returned. It might also fallback to the default configured if the returned locale is not configured or if multi-language support has been disabled by the server-admin.

      Parameters:
      player - The player to fetch the locale from
      Returns:
      The locale of the player or null if the player has no locale
    • fetchAsString

      @Nullable public @Nullable String fetchAsString(Player player)
      Fetches the locale in Java's Locale String format (e.g. "en_US").

      It is recommended to implement this as well for performance reasons, if the locale is already stored in this format. The reason why it exists separately is that Minecraft's clients send the locale in this format.

      Parameters:
      player - The player to fetch the locale from
      Returns:
      The locale of the player in Locale.toString() format or null if the player has no locale