Class Module
java.lang.Object
com.kamikazejam.kamicommon.subsystem.AbstractSubsystem<ModuleConfig, Module>
com.kamikazejam.kamicommon.subsystem.module.Module
- All Implemented Interfaces:
ObservableConfig<KamiConfig>, CoreMethods
This class represents a single module registered under your
A module is a toggleable subsystem that acts like its own plugin, providing its own functionality and configuration.
For a subsystem that cannot be toggled or disabled, see
KamiPlugin plugin.A module is a toggleable subsystem that acts like its own plugin, providing its own functionality and configuration.
For a subsystem that cannot be toggled or disabled, see
Feature.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull ModuleConfigabstract @NotNull VersionedComponent@NotNull File@NotNull StringThe name of the config file (IN SOURCE CODE) for this Module.
By default, it is fetched asKamiPlugin.getModuleYmlPath()/[name]Module.yml
You can override this method, or editKamiPlugin.getModuleYmlPath()to change the path resolution.@NotNull FileThe data folder for this module, located at:
/home/container/plugins/<plugin>/modules/<module>/
If the folder does not exist, it will be created automatically.@NotNull StringThe absolute path to the data folder for this module, i.e.:
/home/container/plugins/<plugin>/modules/<module>/
This is just the File's absolute path, it does not create the folder if it does not exist.final @NotNull StringThe key this module's entries live under in the plugin'smodules.yml, for examplemodules.My_Module.
An alias ofAbstractSubsystem.getSubsystemConfigKey(), kept under its own name because it is public.final @NotNull VersionedComponentprotected @NotNull StringThe top-level section of the plugin-level config that holds every subsystem of this kind:"modules"for aModule, read out ofmodules.yml, and"features"for aFeature, read out offeatures.yml.
This is deliberately NOT the on-disk folder name fromMODULES_FOLDER/FEATURES_FOLDER, even though the words currently match.abstract booleanfinal booleanMethods inherited from class AbstractSubsystem
buildMessage, buildMiniMessage, getConfig, getKamiConfig, getMessage, getMiniMessage, getName, getPlugin, getSubsystemConfigKey, getSupplementalConfigResource, getSupplementalConfigResource, handleDisable, handleEnable, initializeConfig, onDisable, onDisableLater, onEnable, registerCommands, registerConfigObserver, registerDisableables, registerListeners, registerReloadHook, registerTasks, reloadConfig, reloadObservableConfig, saveConfig, unregisterCommands, unregisterCommands, unregisterConfigObserver, unregisterConfigObservers, unregisterDisableables, unregisterDisableables, unregisterListeners, unregisterListeners, unregisterTasks, unregisterTasks
-
Field Details
-
MODULES_FOLDER
- See Also:
-
-
Constructor Details
-
Module
public Module()
-
-
Method Details
-
isEnabledByDefault
public abstract boolean isEnabledByDefault()- Returns:
- Whether this module is enabled by default (generally always true, except in specific situations)
-
defaultPrefix
- Specified by:
defaultPrefixin classAbstractSubsystem<ModuleConfig, Module>- Returns:
- The default logging prefix for this subsystem (saved under the KamiPlugin modulesConfig modulePrefix)
-
getConfigFileDestination
- Specified by:
getConfigFileDestinationin classAbstractSubsystem<ModuleConfig, Module>
-
getConfigResourcePath
The name of the config file (IN SOURCE CODE) for this Module.
By default, it is fetched asKamiPlugin.getModuleYmlPath()/[name]Module.yml
You can override this method, or editKamiPlugin.getModuleYmlPath()to change the path resolution.- Specified by:
getConfigResourcePathin classAbstractSubsystem<ModuleConfig, Module>
-
createConfig
- Specified by:
createConfigin classAbstractSubsystem<ModuleConfig, Module>
-
isEnabledInConfig
@Internal public final boolean isEnabledInConfig() -
getSubsystemConfigSection
Description copied from class:AbstractSubsystemThe top-level section of the plugin-level config that holds every subsystem of this kind:"modules"for aModule, read out ofmodules.yml, and"features"for aFeature, read out offeatures.yml.
This is deliberately NOT the on-disk folder name fromMODULES_FOLDER/FEATURES_FOLDER, even though the words currently match. Those name a directory and this names a config key; tying them together would make renaming the directory silently rename everybody's config keys.- Specified by:
getSubsystemConfigSectionin classAbstractSubsystem<ModuleConfig, Module>- Returns:
- the section name, with no trailing dot
-
getModulesConfigKey
The key this module's entries live under in the plugin'smodules.yml, for examplemodules.My_Module.
An alias ofAbstractSubsystem.getSubsystemConfigKey(), kept under its own name because it is public. It builds nothing itself, so it cannot drift from the key features use. -
getPrefix
- Specified by:
getPrefixin classAbstractSubsystem<ModuleConfig, Module>- Returns:
- The prefix for this subsystem, as defined in the subsystem config
-
getModuleDataFolder
The data folder for this module, located at:
/home/container/plugins/<plugin>/modules/<module>/
If the folder does not exist, it will be created automatically. -
getModuleDataPath
The absolute path to the data folder for this module, i.e.:
/home/container/plugins/<plugin>/modules/<module>/
This is just the File's absolute path, it does not create the folder if it does not exist.
-