Package me.yleoft.zAPI.utils
Class FileUtils
java.lang.Object
me.yleoft.zAPI.utils.FileUtils
FileUtils is a utility class for managing configuration files in a Bukkit plugin.
It provides methods to load, save, and reload configuration files, as well as to save embedded resources.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.configuration.file.FileConfigurationGets the configuration file.getFile()Gets the file.Gets the resource path.voidvoidreloadConfig(boolean copyDefaults) Reloads the configuration file.voidSaves the configuration file.voidSaves the default configuration file if it does not exist.voidsaveResource(String resourcePath, boolean replace) Saves an embedded resource to the plugin's data folder.
-
Constructor Details
-
FileUtils
Creates a new FileUtils instance.- Parameters:
file- The file to be used.resource- The resource path.
-
-
Method Details
-
getConfig
public org.bukkit.configuration.file.FileConfiguration getConfig()Gets the configuration file.- Returns:
- The configuration file.
-
getResource
Gets the resource path.- Returns:
- The resource path.
-
getFile
Gets the file.- Returns:
- The file.
-
reloadConfig
public void reloadConfig(boolean copyDefaults) Reloads the configuration file. -
reloadConfig
public void reloadConfig() -
saveConfig
public void saveConfig()Saves the configuration file. -
saveDefaultConfig
public void saveDefaultConfig()Saves the default configuration file if it does not exist. -
saveResource
Saves an embedded resource to the plugin's data folder.- Parameters:
resourcePath- The path to the resource.replace- Whether to replace the existing file if it exists.- Throws:
IllegalArgumentException- if the resource path is null or empty.
-