Package ch.njol.skript.localization
Class Noun
java.lang.Object
ch.njol.skript.localization.Message
ch.njol.skript.localization.Noun
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal StringgetArticleWithSpace(int flags) static StringgetArticleWithSpace(int gender, int flags) Returns the article appropriate for the given gender invalid input: '&' flags.intstatic intstatic @Nullable StringgetGenderID(int gender) static NonNullPair<String, String> Deprecated, for removal: This API element is subject to removal in a future version.static booleanstatic booleanstatic StringNormalizes plural markers, i.e.protected voidCalled when this Message's value changes.static Noun.PluralPairparsePlural(String input) Parses an input string with plural markers into both its singular and plural forms.static StringstripDefiniteArticle(String string) Removes definite articles, such as 'the', from the providedstring.static NonNullPair<String, Integer> stripGender(String s, String key) Strips the gender identifier from given string and returns the used gender.static StringtoString()toString(boolean plural) toString(int flags) static StringwithAmount(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:MessageCalled 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:
onValueChangein 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
@Deprecated(since="2.14", forRemoval=true) public static NonNullPair<String,String> getPlural(String input) Deprecated, for removal: This API element is subject to removal in a future version.UseparsePlural(String)instead.- Parameters:
input- String with ¦ or : plural markers but without a @gender- Returns:
- (singular, plural)
-
parsePlural
Parses an input string with plural markers into both its singular and plural forms.- Parameters:
input- String with ¦ or : plural markers but without an @gender.- Returns:
- (singular, plural). The two will be the same if no markers exist.
-
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
-
stripDefiniteArticle
Removes definite articles, such as 'the', from the providedstring. -
isIndefiniteArticle
-
isDefiniteArticle
-
toString
-
parsePlural(String)instead.