Interface Plugin
-
public interface Plugin
Represents a plugin. A plugin has a name and provides a list of commands.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description CommandErrorHandler
getCommandErrorHandler()
Gets the command error handler to apply to all commands provided by this plugin.Set<String>
getDatabaseMappingResources()
Gets a set of resource names that corresponds to database mapping files.Map<String,GuildSettingsEntry<?,?>>
getGuildConfigurationEntries()
Gets a map of configuration entries for guilds.String
getName()
Gets the name of the plugin.Set<Command>
getProvidedCommands()
Gets the set of commands that this plugin provides.default reactor.core.publisher.Mono<Void>
onBotReady(Bot bot)
Action to execute when the bot is ready.void
setup(Bot bot, PropertyParser parser)
Code executed when the plugin is loaded.
-
-
-
Method Detail
-
setup
void setup(Bot bot, PropertyParser parser)
Code executed when the plugin is loaded. This allows the plugin to perform additional configuration. Throwing an unchecked exception here will cancel the loading of this plugin and will display a warning in the standard output. Other plugins won't be affected.- Parameters:
bot
- the bot instanceparser
- contains everything defined in plugins.properties, ready to be parsed
-
onBotReady
default reactor.core.publisher.Mono<Void> onBotReady(Bot bot)
Action to execute when the bot is ready. Errors emitted from here will be logged on the WARN level then suppressed.- Parameters:
bot
- the bot instance- Returns:
- a Mono that completes when the action is finished
-
getProvidedCommands
Set<Command> getProvidedCommands()
Gets the set of commands that this plugin provides.- Returns:
- a set of commands
-
getName
String getName()
Gets the name of the plugin.- Returns:
- the name
-
getDatabaseMappingResources
Set<String> getDatabaseMappingResources()
Gets a set of resource names that corresponds to database mapping files. Mapping files usually end with *.hbm.xml and should be located at the root of thesrc/main/resources
directory of the plugin- Returns:
- a set containing the name of all mapping files used in the plugin.
-
getGuildConfigurationEntries
Map<String,GuildSettingsEntry<?,?>> getGuildConfigurationEntries()
Gets a map of configuration entries for guilds. Anything added here will be listed when using the setup command.- Returns:
- the guild configuration entries
-
getCommandErrorHandler
CommandErrorHandler getCommandErrorHandler()
Gets the command error handler to apply to all commands provided by this plugin.- Returns:
- the command error handler
-
-