Package net.gcnt.additionsplus.api.files
Interface YAMLManager
public interface YAMLManager
-
Method Summary
Modifier and TypeMethodDescriptionboolean
copyDefaultFile
(File file, String fileName, String defaultFilePath) Copy the default file contents into the new file.Get a YAMLConfig from a file.Get a previously initialized config file by config IDgetConfigSection
(File file, org.bukkit.configuration.file.FileConfiguration baseYAML, org.bukkit.configuration.ConfigurationSection section) Load a Bukkit configuration section as Additions YAMLSection.getConfigSection
(org.bukkit.configuration.ConfigurationSection section) Load a Bukkit configuration section as Additions YAMLSection.getDefaultFileReader
(String fileName, String defaultFilePath) Get theFileConfiguration
for the file name specifiedloadConfig
(String id, File directory, String fileName) Load config or create it if nonexistentloadConfig
(String id, File directory, String fileName, String defaultDir) Load config or create it if nonexistentloadConfig
(String id, String directory, String fileName) Load config or create it if nonexistentloadConfig
(String id, String directory, String fileName, String defaultDir) Load config or create it if nonexistent
-
Method Details
-
getConfig
Get a YAMLConfig from a file.- Parameters:
file
-File
to get the YAML from.id
- Identifier of the file.- Returns:
YAMLConfig
of the givenFile
.
-
getConfigSection
Load a Bukkit configuration section as Additions YAMLSection. TheYAMLSection
that is returned using this method cannot be used to save the file usingYAMLSection.save()
. If you wish to save the file too, please usegetConfigSection(File, FileConfiguration, ConfigurationSection)
.- Parameters:
section
- Bukkit section to load.- Returns:
YAMLSection
when successful, null otherwise.
-
getConfigSection
YAMLSection getConfigSection(File file, org.bukkit.configuration.file.FileConfiguration baseYAML, org.bukkit.configuration.ConfigurationSection section) Load a Bukkit configuration section as Additions YAMLSection.- Parameters:
file
- File to load from.baseYAML
- Bukkit base file configuration of the section.section
- Bukkit section to load.- Returns:
YAMLSection
when successful, null otherwise.
-
loadConfig
Load config or create it if nonexistent- Parameters:
id
- The internal ID of the configdirectory
- The sub-directory in which to place the config file when createdfileName
- The name of the file placed in the previously mentioned directory- Returns:
- A YAMLConfig instance based on the arguments provided
-
loadConfig
Load config or create it if nonexistent- Parameters:
id
- The internal ID of the configdirectory
- The subdirectory in which to place the config file when createdfileName
- The name of the file placed in the previously mentioned directory- Returns:
- A YAMLConfig instance based on the arguments provided
-
loadConfig
Load config or create it if nonexistent- Parameters:
id
- The internal ID of the configdirectory
- The subdirectory in which to place the config file when createdfileName
- The name of the file placed in the previously mentioned directorydefaultDir
- The internal directory from which to fetch the default file- Returns:
- A YAMLConfig instance based on the arguments provided
-
loadConfig
Load config or create it if nonexistent- Parameters:
id
- The internal ID of the configdirectory
- The sub-directory in which to place the config file when createdfileName
- The name of the file placed in the previously mentioned directorydefaultDir
- The internal directory from which to fetch the default file- Returns:
- A YAMLConfig instance based on the arguments provided
-
getConfig
Get a previously initialized config file by config ID- Parameters:
configId
- The internal config ID of the config- Returns:
- The YAMLConfig instance with the ID provided or null if no YAMLConfig exists with that ID
-
copyDefaultFile
Copy the default file contents into the new file.- Parameters:
file
- File to copy contents to.fileName
- The name of the file to use as the default file.defaultFilePath
- Location of the default file.- Returns:
- True when succeeded, false otherwise.
-
getDefaultFileReader
Get theFileConfiguration
for the file name specified- Parameters:
fileName
- The name of the file to use as the default filedefaultFilePath
- Location of the default file- Returns:
BufferedReader
with the default file contents.
-