Class YamlLanguageResourceInstaller

java.lang.Object
com.winterhavenmc.library.messagebuilder.adapters.resources.language.YamlLanguageResourceInstaller
All Implemented Interfaces:
ResourceInstaller

public final class YamlLanguageResourceInstaller extends Object implements ResourceInstaller
This class is responsible for installing localization resources from the language directory of the jar archive to the language subdirectory of the plugin data directory. Any files listed in an auto_install.txt file with a .yml suffix that are stored as a resource within a /language subdirectory in the plugin jar archive will be copied to the /language subdirectory of the plugin data directory.
  • Constructor Details

    • YamlLanguageResourceInstaller

      public YamlLanguageResourceInstaller(org.bukkit.plugin.Plugin plugin, ConfigRepository configRepository)
      Class constructor
      Parameters:
      plugin - reference to plugin main class
  • Method Details

    • install

      Install resources listed in auto_install.txt to the plugin data directory
      Specified by:
      install in interface ResourceInstaller
    • getAutoInstallResourceName

      public String getAutoInstallResourceName()
      Get path name of the auto install resource
      Returns:
      Section path of the auto install resource
    • getAutoInstallSet

      public Set<String> getAutoInstallSet(String autoInstallPathName)
      Retrieve a Set of resources to be copied into the plugin data directory by reading resource names from the auto-install.txt resource.
      Parameters:
      autoInstallPathName - a Section containing the resource path of the auto install plain text resource
      Returns:
      the set of filenames to be autoinstalled into the plugin data directory
    • installIfMissing

      public ResourceInstaller.InstallerStatus installIfMissing(String resourceName)
      Check if a resource is already present in the plugin data directory
      Parameters:
      resourceName - the resource name
    • installByName

      public ResourceInstaller.InstallerStatus installByName(String resourceName)
      Install resource from plugin jar to plugin data directory.
      Parameters:
      resourceName - Section the path name of the resource to be installed
      Returns:
      a Boolean indicating the success or failure result of the resource installation