Skip to content

Config Headers

TM (Holly) edited this page Jan 10, 2021 · 3 revisions

At the top of each configuration is the header, which is automatically generated to add some sort of introduction to the configuration. Here's how it looks in AdvancedTeleport, by me and Niestrat99:

It is compromised of the following:

  • The plugin name at the very top, centered in the middle.
  • The plugin authors right below it.
  • The plugin description.
  • External links to other useful sources that may be important to the plugin user.

Whilst it does a lot of the work itself, some plugin developers may want their own title or even none at all. In which case, you will need to follow this guide.

All modifications made to headers must be complete before calling the #load method.

Examples of this are below:

CMFile Subclass
public class MyConfigFile extends CMFile {

    public MyConfigFile() {
        super(MyPlugin.getInstance(), "config");
        setTitle("My cool plugin!");
        load();
    }
    
    @Override
    public void loadDefaults() {
        // ...
    }
} 
In-Method Declaration
CMFile myConfigFile = new CMFile() {
    @Override
    public void loadDefaults() {
        // ...
    }
}
myConfigFile.setTitle("My Config Title");
myConfigFile.load();

setTitle

Description: This is the title displayed at the very start of the header, often aligned in the center.
Arguments: String title - the title to be set.

setSubtitle

Description: The subtitle displayed after the title.
Arguments: String subtitle - the subtitle to be set.

setDescription

Description: The description of the plugin to be placed in the second section of the header.
Arguments: String description - the description to be set.

addLink

Description: Adds a link below the description.
Arguments: String name, String link - the name describing the link, then the link itself.

removeLink

Description: Removes a link that was previously added, not really needed but... use it if you need it.
Arguments: String name - the name of the link to be removed.

setDefaultTitleWidth

Description: Sets the default title width to a different minimum. Throws an error if set below 20.
Arguments: int defaultTitleWidth - the width to be set to.

ConfigurationMaster


Basics


Advanced

  • Best Practices
  • Comments
  • Sections
  • Headers
Clone this wiki locally