Package com.zetaplugins.zetacore
Class ZetaCorePlugin
java.lang.Object
org.bukkit.plugin.PluginBase
org.bukkit.plugin.java.JavaPlugin
com.zetaplugins.zetacore.ZetaCorePlugin
- All Implemented Interfaces:
LifecycleEventOwner,CommandExecutor,TabCompleter,TabExecutor,Plugin
Base class for plugins built on ZetaCore.
On enable, the plugin boots itself. It saves the default config, creates the ConfigService and
ServiceRegistry, registers the beans of all Configuration
classes and starts eagerly loaded services and beans. It then registers everything found in the plugin's package:
- permissions (see
PermissionHolder) - commands and tab completers, filtered by
CommandRegistrationCustomizers - event listeners
Papiplaceholders, if PlaceholderAPI is installed, customized byPlaceholderExpansionCustomizers
ZetaPlugin.bstatsId() is set (charts come from MetricsCustomizers)
and runs every UpdateChecker service or bean asynchronously.
Use ZetaPlugin on the main class to change the defaults, and override
onStartup() and onShutdown() for custom logic.
The plugin itself, its Logger, the ConfigService, the ServiceRegistry, the ClassScanner and
every ConfigFile class can be injected into any service.
Injected config objects are updated in place by ConfigService.reload().
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateBStatsMetrics(int pluginId) Creates bStats metrics instance for this plugin.Gets the scanner used to discover this plugin's classes.Gets the config service of this plugin.Gets the plugin jar file.Gets the service registry of this plugin.final voidfinal voidonEnable()protected voidCalled when the plugin is disabled, before services and beans are destroyed (seePreDestroy).protected voidCalled at the end ofonEnable(), after everything is set up.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, onLoad, 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 org.bukkit.plugin.Plugin
getComponentLogger, getLog4JLogger, getSLF4JLogger
-
Constructor Details
-
ZetaCorePlugin
public ZetaCorePlugin()
-
-
Method Details
-
onEnable
public final void onEnable()- Specified by:
onEnablein interfacePlugin- Overrides:
onEnablein classJavaPlugin
-
onDisable
public final void onDisable()- Specified by:
onDisablein interfacePlugin- Overrides:
onDisablein classJavaPlugin
-
onStartup
protected void onStartup()Called at the end ofonEnable(), after everything is set up. -
onShutdown
protected void onShutdown()Called when the plugin is disabled, before services and beans are destroyed (seePreDestroy). Not called if enabling the plugin failed. -
getServiceRegistry
Gets the service registry of this plugin. Only available once the plugin is enabled.- Returns:
- The service registry.
-
getConfigService
Gets the config service of this plugin. Only available once the plugin is enabled.- Returns:
- The config service.
-
getClassScanner
Gets the scanner used to discover this plugin's classes. Only available once the plugin is enabled.- Returns:
- The class scanner.
-
getPluginFile
Gets the plugin jar file.- Returns:
- The plugin file.
-
createBStatsMetrics
Creates bStats metrics instance for this plugin.- Parameters:
pluginId- The plugin bStats id- Returns:
- The metrics instance
-