Package ch.njol.skript.localization
Class Message
java.lang.Object
ch.njol.skript.localization.Message
- Direct Known Subclasses:
Adjective
,ArgsMessage
,FormattedMessage
,Noun
,PluralizingArgsMessage
,RegexMessage
Basic class to get text from the language file(s).
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal @Nullable String
getValue()
Gets the text this Message refers to.final String
getValueOrDefault
(String defaultValue) Gets the text this Message refers to.final boolean
isSet()
Checks whether this value is set in the current language or the english default.protected void
Called when this Message's value changes.toString()
protected void
validate()
Checks whether this message's value has changed and callsonValueChange()
if neccessary.
-
Field Details
-
key
-
-
Constructor Details
-
Message
-
-
Method Details
-
toString
-
getValue
Gets the text this Message refers to. This method automatically revalidates the value if necessary.- Returns:
- This message's value or null if it doesn't exist.
-
getValueOrDefault
Gets the text this Message refers to. If value is null returns a default value.- Parameters:
defaultValue
- The string this method refers to if value is null- Returns:
- This message's value or default value if null
-
isSet
public final boolean isSet()Checks whether this value is set in the current language or the english default.- Returns:
- Whether this message will display an actual value instead of its key when used
-
validate
protected void validate()Checks whether this message's value has changed and callsonValueChange()
if neccessary. -
onValueChange
protected void onValueChange()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.
-