Class Locales

java.lang.Object
net.william278.schematicupload.config.Locales

public class Locales extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NotNull String
    escapeText(@NotNull String string)
    Escape a string from MineDown formatting for use in a MineDown-formatted locale
    @NotNull de.themoep.minedown.adventure.MineDown
    format(@NotNull String text)
    Returns a MineDown-formatted string
    Optional<de.themoep.minedown.adventure.MineDown>
    getLocale(@NotNull String localeId)
    Returns a MineDown-formatted locale from the locales file
    Optional<de.themoep.minedown.adventure.MineDown>
    getLocale(@NotNull String localeId, @NotNull String... replacements)
    Returns a MineDown-formatted locale from the locales file, with replacements applied
    getRawLocale(@NotNull String localeId)
    Returns a raw, unformatted locale loaded from the locales file
    getRawLocale(@NotNull String localeId, @NotNull String... replacements)
    Returns a raw, unformatted locale loaded from the locales file, with replacements applied

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • Locales

      public Locales()
  • Method Details

    • getRawLocale

      public Optional<String> getRawLocale(@NotNull @NotNull String localeId)
      Returns a raw, unformatted locale loaded from the locales file
      Parameters:
      localeId - String identifier of the locale, corresponding to a key in the file
      Returns:
      An Optional containing the locale corresponding to the id, if it exists
    • getRawLocale

      public Optional<String> getRawLocale(@NotNull @NotNull String localeId, @NotNull @NotNull String... replacements)
      Returns a raw, unformatted locale loaded from the locales file, with replacements applied

      Note that replacements will not be MineDown-escaped; use escapeText(String) to escape replacements

      Parameters:
      localeId - String identifier of the locale, corresponding to a key in the file
      replacements - Ordered array of replacement strings to fill in placeholders with
      Returns:
      An Optional containing the replacement-applied locale corresponding to the id, if it exists
    • getLocale

      public Optional<de.themoep.minedown.adventure.MineDown> getLocale(@NotNull @NotNull String localeId)
      Returns a MineDown-formatted locale from the locales file
      Parameters:
      localeId - String identifier of the locale, corresponding to a key in the file
      Returns:
      An Optional containing the formatted locale corresponding to the id, if it exists
    • getLocale

      public Optional<de.themoep.minedown.adventure.MineDown> getLocale(@NotNull @NotNull String localeId, @NotNull @NotNull String... replacements)
      Returns a MineDown-formatted locale from the locales file, with replacements applied

      Note that replacements will be MineDown-escaped before application

      Parameters:
      localeId - String identifier of the locale, corresponding to a key in the file
      replacements - Ordered array of replacement strings to fill in placeholders with
      Returns:
      An Optional containing the replacement-applied, formatted locale corresponding to the id, if it exists
    • format

      @NotNull public @NotNull de.themoep.minedown.adventure.MineDown format(@NotNull @NotNull String text)
      Returns a MineDown-formatted string
      Parameters:
      text - The text to format
      Returns:
      A MineDown object containing the formatted text
    • escapeText

      @NotNull public static @NotNull String escapeText(@NotNull @NotNull String string)
      Escape a string from MineDown formatting for use in a MineDown-formatted locale
      Parameters:
      string - The string to escape
      Returns:
      The escaped string