Yaml Message Utility - C00kier/CookiersLib GitHub Wiki

Utility class for retrieving and colorizing messages from YAML (FileConfiguration) files.


Get Colorized Message without default message

Retrieves and colorizes a string message from the config by a given key.

getColorizedMessage(FileConfiguration config, String key)

Parameters:

  • config — configuration file to read from
  • key — path to the message string

Returns:

  • The colorized message
  • A fallback error message ("[key] config key not found") if the key is not present

Throws:

  • IllegalStateException if config is null

Get Colorized Message with default message

Retrieves and colorizes a string message from the config using a fallback message if the key is not found.

getColorizedMessage(FileConfiguration config, String key, String defaultMessage)

Parameters:

  • config — configuration file to read from
  • key — path to the message string
  • defaultMessage — fallback string if the key is missing

Returns:

  • The colorized message (default or found value)

Throws:

  • IllegalStateException if config is null

Get list of Colorized Messages

Retrieves and colorizes a list of string messages from the config.

getColorizedMessagesFromList(FileConfiguration config, String key)

Parameters:

  • config — configuration file to read from
  • key — path to the list of messages

Returns:

  • List of colorized strings

Throws:

  • IllegalStateException if config is null