Class Noun

java.lang.Object
ch.njol.skript.localization.Message
ch.njol.skript.localization.Noun

public class Noun extends Message
  • Field Details

  • Constructor Details

    • Noun

      public Noun(String key)
  • Method Details

    • onValueChange

      protected void onValueChange()
      Description copied from class: Message
      Called when this Message's value changes. This is not neccessarily called for every language change, but only when the value is actually accessed and the language has changed since the last call of this method.
      Overrides:
      onValueChange in class Message
    • toString

      public String toString()
      Overrides:
      toString in class Message
      Returns:
      The value of this message in the current language
    • toString

      public String toString(boolean plural)
    • withIndefiniteArticle

      public String withIndefiniteArticle()
    • getIndefiniteArticle

      public String getIndefiniteArticle()
    • withDefiniteArticle

      public String withDefiniteArticle()
    • withDefiniteArticle

      public String withDefiniteArticle(boolean plural)
    • getDefiniteArticle

      public String getDefiniteArticle()
    • getGender

      public int getGender()
    • getArticleWithSpace

      public static String getArticleWithSpace(int gender, int flags)
      Returns the article appropriate for the given gender invalid input: '&' flags.
      Parameters:
      flags -
      Returns:
      The article with a trailing space (as no article is possible in which case the empty string is returned)
    • getArticleWithSpace

      public final String getArticleWithSpace(int flags)
      Parameters:
      flags -
      Returns:
      getArticleWithSpace(getGender(), flags)
    • toString

      public String toString(int flags)
    • withAmount

      public String withAmount(double amount)
    • withAmount

      public String withAmount(double amount, int flags)
    • toString

      public String toString(Adjective a, int flags)
    • toString

      public String toString(Adjective[] adjectives, int flags, boolean and)
    • getSingular

      public String getSingular()
    • getPlural

      public String getPlural()
    • getPlural

      public static NonNullPair<String,String> getPlural(String s)
      Parameters:
      s - String with ¦ plural markers but without a @gender
      Returns:
      (singular, plural)
    • normalizePluralMarkers

      public static String normalizePluralMarkers(String s)
      Normalizes plural markers, i.e. increases the total number of markers to a multiple of 3 without changing the string's meaning.

      A @gender at the end of the string will be treated correctly.

      Parameters:
      s - Some string
      Returns:
      The same string with normalized plural markers
    • getGender

      public static int getGender(String gender, String key)
      Parameters:
      gender - Gender id as defined in [language].lang (i.e. without the leading @)
      key - Key to use in error messages§
      Returns:
      The gender's id
    • getGenderID

      @Nullable public static @Nullable String getGenderID(int gender)
    • stripGender

      public static NonNullPair<String,Integer> stripGender(String s, String key)
      Strips the gender identifier from given string and returns the used gender.
      Parameters:
      s - String.
      key - Key to report in case of error.
      Returns:
      (stripped string, gender or -1 if none)
    • stripIndefiniteArticle

      public static String stripIndefiniteArticle(String s)
    • isIndefiniteArticle

      public static boolean isIndefiniteArticle(String s)
    • isDefiniteArticle

      public static boolean isDefiniteArticle(String s)
    • toString

      public static String toString(String singular, String plural, int gender, int flags)