java.lang.Object
org.bukkit.plugin.PluginBase
org.bukkit.plugin.java.JavaPlugin
io.github.projectunified.minelib.plugin.base.BasePlugin
All Implemented Interfaces:
Loadable, io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner, org.bukkit.command.CommandExecutor, org.bukkit.command.TabCompleter, org.bukkit.command.TabExecutor, org.bukkit.plugin.Plugin

public class BasePlugin extends org.bukkit.plugin.java.JavaPlugin implements Loadable
Base plugin class that provides a simple way to manage components
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new plugin instance
  • Method Summary

    Modifier and Type
    Method
    Description
    final <T> void
    call(Class<T> type, Consumer<T> consumer)
    Call a consumer for each component of a given type.
    final <T> void
    call(Class<T> type, Consumer<T> consumer, boolean reverse)
    Call a consumer for each component of a given type.
    final <T> T
    get(Class<T> type)
    Get a component by its class.
    protected List<Object>
    Get the components that should be managed by the plugin.
    final void
     
    final void
     
    final void
     

    Methods inherited from class org.bukkit.plugin.java.JavaPlugin

    getClassLoader, getCommand, getConfig, getDataFolder, getDefaultBiomeProvider, getDefaultWorldGenerator, getDescription, getFile, getLifecycleManager, getLogger, getPlugin, getPluginLoader, getPluginMeta, getProvidingPlugin, getResource, getServer, getTextResource, init, init, isEnabled, isNaggable, onCommand, onTabComplete, reloadConfig, saveConfig, saveDefaultConfig, saveResource, setEnabled, setNaggable, toString

    Methods inherited from class org.bukkit.plugin.PluginBase

    equals, getName, hashCode

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.github.projectunified.minelib.plugin.base.Loadable

    disable, enable, load

    Methods inherited from interface org.bukkit.plugin.Plugin

    getComponentLogger, getLog4JLogger, getSLF4JLogger
  • Constructor Details

    • BasePlugin

      public BasePlugin()
      Create a new plugin instance
  • Method Details

    • getComponents

      protected List<Object> getComponents()
      Get the components that should be managed by the plugin. Plugins should override this method to provide their own components.
      Returns:
      a list of components
    • get

      public final <T> T get(Class<T> type)
      Get a component by its class.
      Type Parameters:
      T - the type of the component
      Parameters:
      type - the class of the component
      Returns:
      the component
    • call

      public final <T> void call(Class<T> type, Consumer<T> consumer, boolean reverse)
      Call a consumer for each component of a given type.
      Type Parameters:
      T - the type of the component
      Parameters:
      type - the class of the component
      consumer - the consumer to call
      reverse - whether to iterate in reverse order
    • call

      public final <T> void call(Class<T> type, Consumer<T> consumer)
      Call a consumer for each component of a given type.
      Type Parameters:
      T - the type of the component
      Parameters:
      type - the class of the component
      consumer - the consumer to call
    • onLoad

      public final void onLoad()
      Specified by:
      onLoad in interface org.bukkit.plugin.Plugin
      Overrides:
      onLoad in class org.bukkit.plugin.java.JavaPlugin
    • onEnable

      public final void onEnable()
      Specified by:
      onEnable in interface org.bukkit.plugin.Plugin
      Overrides:
      onEnable in class org.bukkit.plugin.java.JavaPlugin
    • onDisable

      public final void onDisable()
      Specified by:
      onDisable in interface org.bukkit.plugin.Plugin
      Overrides:
      onDisable in class org.bukkit.plugin.java.JavaPlugin