Skip to content

ConfigType

MDT168 edited this page Aug 17, 2026 · 2 revisions

ConfigType

The ConfigType class defines where a config file is saved and sets up optional header comments at the top of the file.


Constructors

ConfigType(String extraPath, String prefix)

Creates a config type with a file path and header comments.

  • extraPath: The relative path for the config file. The library automatically adds "configs/" to the start of this path.
  • prefix: Text to place at the top of the file as a comment, or null if you do not want a header. Every line is automatically turned into a comment starting with # and ends with a blank line.

ConfigType(String extraPath)

Creates a config type with a file path and no header comments.

  • extraPath: The relative path for the config file. The library automatically adds "configs/" to the start of this path.

Example: If you passed main_config.yml as the extraPath, your file will live in configs/main_config.yml inside your Plugin Data Folder


Instance Methods

getExtraPath()

Gets the relative file path.

  • Returns: The path string starting with "configs/".

getPrefix()

Gets the formatted header comment string.

  • Returns: The comment header string, or an empty string if no prefix was set.

getPath(Path dataFolder)

Combines a base folder path with the config file path to get the full file location.

  • Parameters: dataFolder - The main plugin folder path.
  • Returns: A Path object pointing to the full file location.

Clone this wiki locally