Package dev.cwhead.GravesX.addon
Class GravesXAddon
java.lang.Object
dev.cwhead.GravesX.addon.GravesXAddon
Handles Addon Creation
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleancopyResourceIfNeeded(Graves plugin, String resourcePath, File target, boolean replace) Helper: copy a single resource from the JAR to a target file if needed.static FileensureAddonFolder(Graves plugin, String addonName) Ensures plugins/'PluginName'/addon/'addonName' exists and returns it.static voidensureAddonRoot(Graves plugin) Ensures plugins/'PluginName'/addon exists.static intexportAddonConfigs(Graves plugin, String addonName, boolean replaceIfExists) Copies all *.yml files found in resources at: addon/'addonName'/...private static StringAllow letters, numbers, dot, underscore, dash; replace others with '_'
-
Constructor Details
-
GravesXAddon
public GravesXAddon()
-
-
Method Details
-
ensureAddonRoot
Ensures plugins/'PluginName'/addon exists. -
ensureAddonFolder
Ensures plugins/'PluginName'/addon/'addonName' exists and returns it. -
exportAddonConfigs
Copies all *.yml files found in resources at: addon/'addonName'/... into: plugins/GravesX/addon/'addonName'/'file'.yml Skips files that already exist (set replaceIfExists=true to overwrite).- Returns:
- number of files written
-
copyResourceIfNeeded
private static boolean copyResourceIfNeeded(Graves plugin, String resourcePath, File target, boolean replace) throws IOException Helper: copy a single resource from the JAR to a target file if needed.- Throws:
IOException
-
sanitize
Allow letters, numbers, dot, underscore, dash; replace others with '_'
-