VitalModule

abstract class VitalModule : VitalHasInfo

A module includes additional features within the Vital ecosystem. Every module is essentially a Configuration and should define every module bean. Additionally, a module can also display what features are added, etc.

@VitalModule.Info("mymodule")
public class MyModule extends VitalModule {
@Override
public void onEnable() {
// ...
}

@Override
public void onDisable() {
// ...
}
}

Inheritors

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
@Configuration(proxyBeanMethods = false)
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class Info(val value: String)

Defines the info of a VitalModule. This annotation must be applied to all implementations of VitalModule.

Properties

Link copied to clipboard

All info metadata for this class, indexed by their unique Class. Can be initialized with VitalCoreModule.getRequiredAnnotation or VitalCoreModule.getRequiredAnnotations.

Link copied to clipboard
lateinit var vitalPlugin: VitalPlugin

Functions

Link copied to clipboard
fun disable(vitalPlugin: VitalPlugin)

Disables this module by calling the onDisable lifecycle function. The module is only disabled if it is currently enabled.

Link copied to clipboard
fun enable(vitalPlugin: VitalPlugin)

Enables this module by calling the onEnable lifecycle function. The module is only enabled if it is not already enabled.

Link copied to clipboard
open fun <T : Annotation> getInfo(type: Class<T>): T

Gets the info annotation for the given type. If no info annotation was found, throws RuntimeException.

Link copied to clipboard
open fun onDisable()

Lifecycle function; called when this module is disabled. Override this function to for example perform teardown logic for your module.

Link copied to clipboard
open fun onEnable()

Lifecycle function; called when this module is enabled. Override this function to for example perform initialization logic for your module.