Class Message

Direct Known Subclasses:
Adjective, ArgsMessage, FormattedMessage, Noun, PluralizingArgsMessage, RegexMessage

public class Message extends Object
Basic class to get text from the language file(s).
  • Field Details

    • key

      public final String key
  • Constructor Details

    • Message

      public Message(String key)
  • Method Details

    • toString

      public String toString()
      toString in class Object
      The value of this message in the current language
    • getValue

      public final @Nullable String getValue()
      Gets the text this Message refers to. This method automatically revalidates the value if necessary.
      This message's value or null if it doesn't exist.
    • getValueOrDefault

      public final String getValueOrDefault(String defaultValue)
      Gets the text this Message refers to. If value is null returns a default value.
      defaultValue - The string this method refers to if value is null
      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.
      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 calls onValueChange() 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.