Package ch.njol.skript.localization
Class Noun
java.lang.Object
ch.njol.skript.localization.Message
ch.njol.skript.localization.Noun
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal String
getArticleWithSpace
(int flags) static String
getArticleWithSpace
(int gender, int flags) Returns the article appropriate for the given gender invalid input: '&' flags.int
static int
static @Nullable String
getGenderID
(int gender) static NonNullPair
<String, String> static boolean
static boolean
static String
Normalizes plural markers, i.e.protected void
Called when this Message's value changes.static NonNullPair
<String, Integer> stripGender
(String s, String key) Strips the gender identifier from given string and returns the used gender.static String
toString()
toString
(boolean plural) toString
(int flags) static String
withAmount
(double amount) withAmount
(double amount, int flags) withDefiniteArticle
(boolean plural) Methods inherited from class ch.njol.skript.localization.Message
getValue, getValueOrDefault, isSet, validate
-
Field Details
-
GENDERS_SECTION
- See Also:
-
PLURAL
public static final int PLURAL- See Also:
-
NO_GENDER
public static final int NO_GENDER- See Also:
-
PLURAL_TOKEN
- See Also:
-
NO_GENDER_TOKEN
- See Also:
-
-
Constructor Details
-
Noun
-
-
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 classMessage
-
toString
-
toString
-
withIndefiniteArticle
-
getIndefiniteArticle
-
withDefiniteArticle
-
withDefiniteArticle
-
getDefiniteArticle
-
getGender
public int getGender() -
getArticleWithSpace
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
- Parameters:
flags
-- Returns:
getArticleWithSpace
(getGender(), flags)
-
toString
-
withAmount
-
withAmount
-
toString
-
toString
-
getSingular
-
getPlural
-
getPlural
- Parameters:
s
- String with ¦ plural markers but without a @gender- Returns:
- (singular, plural)
-
normalizePluralMarkers
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
- 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
-
stripGender
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
-
isIndefiniteArticle
-
isDefiniteArticle
-
toString
-