Class Plugin

  • Direct Known Subclasses:
    FocessQQ.MainPlugin, LazyPlugin

    public abstract class Plugin
    extends Object
    Represent a Plugin class that can be load, enable and disable. Also, provide plenty of API for the plugin to get better with this framework. You should declare PluginType to this class.
    • Constructor Detail

      • Plugin

        public Plugin​(String name,
                      String author,
                      Version version)
        Initialize a Plugin instance by its name. Never instance it! It will be instanced when bot bootstraps automatically.
        Parameters:
        name - the plugin name
        author - the plugin author
        version - the plugin version
        Throws:
        PluginLoaderException - if the classloader of the plugin is not PluginClassLoader
      • Plugin

        protected Plugin()
        Provide a constructor to help PluginType design. Never instance it! It will be instanced when bot bootstraps automatically.
    • Method Detail

      • thisPlugin

        @Nullable
        public static Plugin thisPlugin()
      • getName

        @NotNull
        public String getName()
      • enable

        public abstract void enable()
        Used to initialize the plugin
      • disable

        public abstract void disable()
        Used to save some data of the plugin
      • onEnable

        public final void onEnable()
      • onDisable

        public final void onDisable()
      • getDefaultFolder

        @NotNull
        public File getDefaultFolder()
      • getConfigFile

        @NotNull
        @Deprecated
        public File getConfigFile()
        Deprecated.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • registerListener

        public void registerListener​(Listener listener)
        Register the listener into the Event chain
        Parameters:
        listener - the listener need to be registered
      • registerCommand

        public void registerCommand​(Command command)
        Register the command
        Parameters:
        command - the command need to be registered
      • registerBuffer

        public void registerBuffer​(DataConverter<?> dataConverter,
                                   DataCollection.BufferGetter bufferGetter)
        Register the getter of the buffer
        Parameters:
        dataConverter - the buffer data converter
        bufferGetter - the getter of the buffer
      • getAuthor

        public String getAuthor()
      • getVersion

        public Version getVersion()
      • getLangConfig

        public LangConfig getLangConfig()
      • isEnabled

        public boolean isEnabled()