java.lang.Object
net.foxgenesis.watame.plugin.Plugin
- All Implemented Interfaces:
AutoCloseable
NEED_JAVADOC
- Author:
- Ashley
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal PathPath to the plugin's configuration folderfinal StringDescription of the plugin.final StringFriendly identifier of the plugin.protected final org.slf4j.LoggerPlugin loggerfinal StringName identifier of the plugin.final booleanDoes this plugin require access to the database.final booleanDoes this plugin provide commands.final Runtime.VersionVersion of the plugin. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected net.dv8tion.jda.api.interactions.commands.build.CommandDatagetCommandData(String command) protected Collection<net.dv8tion.jda.api.interactions.commands.build.CommandData>protected org.apache.commons.configuration2.PropertiesConfigurationgetConfiguration(String identifier) Get the configuration file that is linked to anidentifierornullif not found.protected booleanhasCommandData(String command) protected booleanhasConfiguration(String identifier) Check if a configuration file with the specifiedidentifierexists.inthashCode()protected abstract voidinit(ProtectedJDABuilder builder) protected abstract voidonConfigurationLoaded(String identifier, org.apache.commons.configuration2.PropertiesConfiguration properties) protected abstract voidonPropertiesLoaded(Properties properties) protected abstract voidprotected abstract voidprotected abstract voidpreInit()Startup method called when resources, needed for functionality initialization, are to be loaded.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.AutoCloseable
close
-
Field Details
-
logger
@Nonnull protected final org.slf4j.Logger loggerPlugin logger -
configurationPath
Path to the plugin's configuration folder -
name
Name identifier of the plugin. -
friendlyName
Friendly identifier of the plugin. -
description
Description of the plugin. -
version
Version of the plugin. -
providesCommands
public final boolean providesCommandsDoes this plugin provide commands. -
needsDatabase
public final boolean needsDatabaseDoes this plugin require access to the database.
-
-
Constructor Details
-
Plugin
No-arg constructor to load and initialize required plugin data.- Throws:
SeverePluginException- if the plugin is not in a named module or there was a problem while loading theplugin.propertiesfile
-
-
Method Details
-
hasConfiguration
Check if a configuration file with the specifiedidentifierexists.- Parameters:
identifier- - thePluginConfiguration.identifier()- Returns:
- Returns
trueif the specifiedidentifierpoints to a valid configuration
-
getConfiguration
@Nullable protected org.apache.commons.configuration2.PropertiesConfiguration getConfiguration(String identifier) Get the configuration file that is linked to anidentifierornullif not found.- Parameters:
identifier- - thePluginConfiguration.identifier()- Returns:
- Returns the
PropertiesConfigurationlinked to theidentifier
-
hasCommandData
-
getCommandData
@Nullable protected net.dv8tion.jda.api.interactions.commands.build.CommandData getCommandData(String command) -
getCommands
@Nonnull protected Collection<net.dv8tion.jda.api.interactions.commands.build.CommandData> getCommands() -
onPropertiesLoaded
-
onConfigurationLoaded
protected abstract void onConfigurationLoaded(String identifier, org.apache.commons.configuration2.PropertiesConfiguration properties) -
preInit
Startup method called when resources, needed for functionality initialization, are to be loaded. Resources that do not require connection to Discord or the database should be loaded here.Database and Discord information might not be loaded at the time of this method! Use
onReady(WatameBot)for functionality that requires valid connections.Typical resources to load here include:
- SQL compiled statements
- System Data
- Files
- Images
- Throws:
SeverePluginException- See Also:
-
init
- Throws:
SeverePluginException
-
postInit
- Throws:
SeverePluginException
-
onReady
- Throws:
SeverePluginException
-
getDisplayInfo
-
toString
-
hashCode
public int hashCode() -
equals
-