Package com.avrix.plugin
Class Plugin
java.lang.Object
com.avrix.plugin.Plugin
Basic template for implementing the plugin entry point.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcopyConfigFromJar(String fileName, File destination) Copies a configuration file from the jar archive to the specified destination.final FileReturns aFileobject representing the configuration directory for this plugin.final YamlFileReturns the default configuration file.final MetadataReturns theMetadataassociated with this plugin.final YamlFileloadConfig(String configPath) Loading the configuration file.final voidLoading the default configuration file.abstract voidCalled when the plugin is initialized.
-
Constructor Details
-
Method Details
-
getDefaultConfig
Returns the default configuration file.- Returns:
- a
YamlFileobject, ornull
-
getConfigFolder
Returns aFileobject representing the configuration directory for this plugin. The directory path is normalized to prevent problems with various file systems.- Returns:
- A
Fileobject pointing to the normalized path to the plugin configuration directory.
-
getMetadata
Returns theMetadataassociated with this plugin.- Returns:
- The
Metadataof 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
YamlFileobject, 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.
-