Class BasePlugin
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
Base plugin class that provides a simple way to manage components
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal <T> voidCall a consumer for each component of a given type.final <T> voidCall a consumer for each component of a given type.final <T> TGet a component by its class.Get the components that should be managed by the plugin.final voidfinal voidonEnable()final voidonLoad()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, toStringMethods inherited from class org.bukkit.plugin.PluginBase
equals, getName, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.github.projectunified.minelib.plugin.base.Loadable
disable, enable, loadMethods inherited from interface org.bukkit.plugin.Plugin
getComponentLogger, getLog4JLogger, getSLF4JLogger
-
Constructor Details
-
BasePlugin
public BasePlugin()Create a new plugin instance
-
-
Method Details
-
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
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
Call a consumer for each component of a given type.- Type Parameters:
T- the type of the component- Parameters:
type- the class of the componentconsumer- the consumer to callreverse- whether to iterate in reverse order
-
call
Call a consumer for each component of a given type.- Type Parameters:
T- the type of the component- Parameters:
type- the class of the componentconsumer- the consumer to call
-
onLoad
public final void onLoad()- Specified by:
onLoadin interfaceorg.bukkit.plugin.Plugin- Overrides:
onLoadin classorg.bukkit.plugin.java.JavaPlugin
-
onEnable
public final void onEnable()- Specified by:
onEnablein interfaceorg.bukkit.plugin.Plugin- Overrides:
onEnablein classorg.bukkit.plugin.java.JavaPlugin
-
onDisable
public final void onDisable()- Specified by:
onDisablein interfaceorg.bukkit.plugin.Plugin- Overrides:
onDisablein classorg.bukkit.plugin.java.JavaPlugin
-