All Implemented Interfaces:
ObservableConfig, CoreMethods

public abstract class Module extends AbstractSubsystem<ModuleConfig,Module>
This class represents a single module registered under your 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 Details

  • 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

      @NotNull public abstract @NotNull VersionedComponent defaultPrefix()
      Specified by:
      defaultPrefix in class AbstractSubsystem<ModuleConfig,Module>
      Returns:
      The default logging prefix for this subsystem (saved under the KamiPlugin modulesConfig modulePrefix)
    • getConfigFileDestination

      @NotNull public @NotNull File getConfigFileDestination()
      Specified by:
      getConfigFileDestination in class AbstractSubsystem<ModuleConfig,Module>
    • getConfigResourcePath

      @NotNull public @NotNull String getConfigResourcePath()
      The name of the config file (IN SOURCE CODE) for this Module.

      By default, it is fetched as KamiPlugin.getModuleYmlPath()/[name]Module.yml

      You can override this method, or edit KamiPlugin.getModuleYmlPath() to change the path resolution.
      Specified by:
      getConfigResourcePath in class AbstractSubsystem<ModuleConfig,Module>
    • createConfig

      @OverrideOnly @NotNull public @NotNull ModuleConfig createConfig()
      Specified by:
      createConfig in class AbstractSubsystem<ModuleConfig,Module>
    • isEnabledInConfig

      @Internal public final boolean isEnabledInConfig()
    • getPrefix

      @NotNull public final @NotNull VersionedComponent getPrefix()
      Specified by:
      getPrefix in class AbstractSubsystem<ModuleConfig,Module>
      Returns:
      The prefix for this subsystem, as defined in the subsystem config
    • getModuleDataFolder

      @NotNull public @NotNull File 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

      @NotNull public @NotNull String 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.