Interface Plugin


public interface Plugin
Represents a plugin. A plugin has a name and provides a list of commands.
  • Method Summary

    Modifier and Type Method Description
    CommandProvider getCommandProvider()
    Gets the command provider for this plugin.
    java.util.Set<java.lang.String> getDatabaseMappingResources()
    Gets a set of resource names that corresponds to database mapping files.
    default reactor.core.publisher.Mono<java.util.Properties> getGitProperties()
    Gets the Git properties for this plugin.
    java.util.Map<java.lang.String,​GuildSettingsEntry<?,​?>> getGuildConfigurationEntries()
    Gets a map of configuration entries for guilds.
    java.lang.String getName()
    Gets the name of the plugin.
    default reactor.core.publisher.Mono<java.lang.Void> onBotReady​(Bot bot)
    Action to execute when the bot is ready.
    reactor.core.publisher.Mono<java.lang.Void> setup​(Bot bot, PropertyParser parser)
    Code executed when the plugin is loaded.
  • Method Details

    • setup

      reactor.core.publisher.Mono<java.lang.Void> setup​(Bot bot, PropertyParser parser)
      Code executed when the plugin is loaded. This allows the plugin to perform additional configuration. Emittiong an error 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 instance
      parser - contains everything defined in plugins.properties, ready to be parsed
      Returns:
      a Mono that completes to indicate that the setup is done
    • onBotReady

      default reactor.core.publisher.Mono<java.lang.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
    • getName

      java.lang.String getName()
      Gets the name of the plugin.
      Returns:
      the name
    • getDatabaseMappingResources

      java.util.Set<java.lang.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 the src/main/resources directory of the plugin
      Returns:
      a set containing the name of all mapping files used in the plugin.
    • getGuildConfigurationEntries

      java.util.Map<java.lang.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
    • getCommandProvider

      CommandProvider getCommandProvider()
      Gets the command provider for this plugin.
      Returns:
      the command provider
    • getGitProperties

      default reactor.core.publisher.Mono<java.util.Properties> getGitProperties()
      Gets the Git properties for this plugin. By default, it will look for a file named [plugin name].git.properties (where plugin name is the name of the plugin as returned by getName() but all lowercase and with spaces replaced with underscores), in the gitprops/ subdirectory of the resource classpath. If none is found, the returned Mono will complete empty.
      Returns:
      a Mono emitting the git properties if found