Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Modules

Daniel Naylor edited this page Aug 16, 2016 · 1 revision

Modules are the heart of this module loader, perhaps unsurprisingly. Modules are simply classes that allow QSML to setup a module.

A module is made up of two parts:

  • The Module interface, which should extend a class that represents a module.
  • The ModuleData annotation for decorating a module class..

Strictly speaking, only the Module interface is required, however, using the ModuleData annotation is strongly recommended.

The Module Interface

The only method that is required to be implemented in the Module interface is the onEnable method. This method will run the logic for setting up your module. There are also onPreEnable and onPostEnable methods that you can fill out for running before or after this onEnable method. Note that QSML runs all modules' onPreEnable, onEnable and onPostEnable methods together, so in onEnable, you can be sure that every module has at least run the onPreEnable method.

The getConfigAdapter method is used to register a configuration section in the main configuration file. Configuration adapters will be discussed in a future doc update.

The ModuleData Annotation

The ModuleData annotation allows you to specify how the modules are displayed to the user. This decorates the class that implements the Module interface

  • id will be used in identifying the module, including in the configuration file.
  • name will potentially be displayed to the user.
  • status will define whether the module will load by default.
  • isRequired will define whether the module MUST always be loaded.
Clone this wiki locally