Package com.avrix.plugin
Class Plugin
java.lang.Object
com.avrix.plugin.Plugin
Basic template for implementing the plugin entry point.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
copyConfigFromJar
(String fileName, File destination) Copies a configuration file from the jar archive to the specified destination.final File
Returns aFile
object representing the configuration directory for this plugin.final YamlFile
Returns the default configuration file.final Metadata
Returns theMetadata
associated with this plugin.final YamlFile
loadConfig
(String configPath) Loading the configuration file.final void
Loading the default configuration file.abstract void
Called when the plugin is initialized.
-
Constructor Details
-
Method Details
-
getDefaultConfig
Returns the default configuration file.- Returns:
- a
YamlFile
object, ornull
-
getConfigFolder
Returns aFile
object representing the configuration directory for this plugin. The directory path is normalized to prevent problems with various file systems.- Returns:
- A
File
object pointing to the normalized path to the plugin configuration directory.
-
getMetadata
Returns theMetadata
associated with this plugin.- Returns:
- The
Metadata
of the plugin.
-
loadDefaultConfig
public final void loadDefaultConfig()Loading the default configuration file. If there is no config in the plugin resources folder, it is saved from the Jar archive and then loaded.If the configuration file cannot be loaded (for example, it is not in the Jar folder), then a new empty config is created.
-
copyConfigFromJar
Copies a configuration file from the jar archive to the specified destination.- Parameters:
fileName
- the name of the configuration file to be copieddestination
- the destination file where the configuration will be copied
-
loadConfig
Loading the configuration file. If there is no config in the plugin resources folder, it is saved from the Jar archive and then loaded.If the configuration file cannot be loaded (for example, it is not in the Jar folder), then a new empty config is created.
- Parameters:
configPath
- path to the configuration file, relative to the plugin resources folder/root folder inside the Jar- Returns:
- returns a
YamlFile
object, which is a configuration file.
-
onInitialize
public abstract void onInitialize()Called when the plugin is initialized.Implementing classes should override this method to provide the initialization logic.
-