Class YamlLanguageResourceInstaller
java.lang.Object
com.winterhavenmc.library.messagebuilder.adapters.resources.language.YamlLanguageResourceInstaller
- All Implemented Interfaces:
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.winterhavenmc.library.messagebuilder.core.ports.resources.ResourceInstaller
ResourceInstaller.InstallerStatus -
Field Summary
Fields inherited from interface com.winterhavenmc.library.messagebuilder.core.ports.resources.ResourceInstaller
LEADING_SLASHES, TWO_OR_MORE_DOTS, TWO_OR_MORE_SLASHES, WHITESPACE -
Constructor Summary
ConstructorsConstructorDescriptionYamlLanguageResourceInstaller(org.bukkit.plugin.Plugin plugin, ConfigRepository configRepository) Class constructor -
Method Summary
Modifier and TypeMethodDescriptionGet path name of the auto install resourcegetAutoInstallSet(String autoInstallPathName) Retrieve aSetof resources to be copied into the plugin data directory by reading resource names from the auto-install.txt resource.install()Install resources listed in auto_install.txt to the plugin data directoryinstallByName(String resourceName) Install resource from plugin jar to plugin data directory.installIfMissing(String resourceName) Check if a resource is already present in 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:
installin interfaceResourceInstaller
-
getAutoInstallResourceName
Get path name of the auto install resource- Returns:
- Section path of the auto install resource
-
getAutoInstallSet
Retrieve aSetof resources to be copied into the plugin data directory by reading resource names from the auto-install.txt resource.- Parameters:
autoInstallPathName- aSectioncontaining the resource path of the auto install plain text resource- Returns:
- the set of filenames to be autoinstalled into the plugin data directory
-
installIfMissing
Check if a resource is already present in the plugin data directory- Parameters:
resourceName- the resource name
-
installByName
Install resource from plugin jar to plugin data directory.- Parameters:
resourceName-Sectionthe path name of the resource to be installed- Returns:
- a
Booleanindicating the success or failure result of the resource installation
-