Class Feature

All Implemented Interfaces:
ObservableConfig<KamiConfig>, CoreMethods

public abstract class Feature extends AbstractSubsystem<FeatureConfig, Feature>
This class represents a single feature registered under your KamiPlugin plugin.
A feature is a subsystem that acts like its own plugin, providing its own functionality and configuration.
Features cannot be disabled or toggled, they are always enabled.
For a subsystem that can be toggled or disabled, see Module.
  • Field Details

  • Constructor Details

    • Feature

      public Feature()
  • Method Details

    • defaultPrefix

      @NotNull public abstract @NotNull VersionedComponent defaultPrefix()
      Specified by:
      defaultPrefix in class AbstractSubsystem<FeatureConfig, Feature>
      Returns:
      The default logging prefix for this subsystem (saved under the KamiPlugin featuresConfig featurePrefix)
    • getConfigFileDestination

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

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

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

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

      @OverrideOnly @NotNull public @NotNull FeatureConfig createConfig()
      Specified by:
      createConfig in class AbstractSubsystem<FeatureConfig, Feature>
    • getSubsystemConfigSection

      @NotNull protected @NotNull String getSubsystemConfigSection()
      Description copied from class: AbstractSubsystem
      The top-level section of the plugin-level config that holds every subsystem of this kind: "modules" for a Module, read out of modules.yml, and "features" for a Feature, read out of features.yml.

      This is deliberately NOT the on-disk folder name from MODULES_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:
      getSubsystemConfigSection in class AbstractSubsystem<FeatureConfig, Feature>
      Returns:
      the section name, with no trailing dot
    • getPrefix

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

      @NotNull public @NotNull File getFeatureDataFolder()
      The data folder for this feature, located at:
      /home/container/plugins/<plugin>/features/<feature>/

      If the folder does not exist, it will be created automatically.
    • getFeatureDataPath

      @NotNull public @NotNull String getFeatureDataPath()
      The absolute path to the data folder for this feature, i.e.:
      /home/container/plugins/<plugin>/features/<feature>/

      This is just the File's absolute path, it does not create the folder if it does not exist.