Package com.stardevllc.starmclib.plugin
Class ExtendedJavaPlugin
java.lang.Object
org.bukkit.plugin.PluginBase
org.bukkit.plugin.java.JavaPlugin
com.stardevllc.starmclib.plugin.ExtendedJavaPlugin
- All Implemented Interfaces:
org.bukkit.command.CommandExecutor,org.bukkit.command.TabCompleter,org.bukkit.command.TabExecutor,org.bukkit.plugin.Plugin
- Direct Known Subclasses:
StarMCLibPlugin
public class ExtendedJavaPlugin
extends org.bukkit.plugin.java.JavaPlugin
A class that extends
JavaPlugin that defines some extra things that are useful and/or consistent-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.stardevllc.config.file.FileConfigDefines a FileConfig instance. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newExtendedJavaPlugin
There needs to always be a no-args constructor for Bukkit/Spigot/Paper -
Method Summary
Modifier and TypeMethodDescriptionprotected StarColorsV2Creates the colors instance for this plugin
By default it just calls the standard constructor of theStarColorsV2classprotected com.stardevllc.starlib.eventbus.IEventBus<?, org.bukkit.event.Cancellable> Creates a plugin event bus for this plugin.
By default it just creates a newPluginEventBususing the constructor
Override for a custom implementationprotected com.stardevllc.starlib.injector.FieldInjectorCreates a new Field Injector instance
This creates an instace ofPluginFieldInjectorby defaultThis is the Plugin's specificStarColorsV2
Mainly used for customization and consistency for things related to this plugincom.stardevllc.starlib.eventbus.IEventBus<?, ?> This is the Plugin's specificPluginEventBuscom.stardevllc.starlib.injector.FieldInjectorThis is the plugin'sFieldInjectorused in the plugincom.stardevllc.config.file.FileConfigGets the main config of this pluginvoidonEnable()protected voidregisterCommand(StarCommand<?> command, StarCommand<?>... cmds) Registers aStarCommand.protected voidregisterCommand(String cmd, org.bukkit.command.CommandExecutor executor) Registers a command to the plugin.protected voidregisterCommand(String cmd, org.bukkit.command.CommandExecutor executor, org.bukkit.command.TabCompleter tabCompleter) Registers a command to the plugin with null safety for the commandprotected voidregisterCommand(String cmd, org.bukkit.command.TabExecutor tabExecutor) Registers a command to the plugin
This does the same thing asregisterCommand(cmd, tabExecutor, tabExecutorprotected voidAllows custom registration of this plugin's injector to the global injector in StarMCLibprotected voidregisterListeners(org.bukkit.event.Listener... listeners) Registers the listeners to the PluginManager with this pluginvoidReloads the main configvoidSaves the main configMethods inherited from class org.bukkit.plugin.java.JavaPlugin
getClassLoader, getCommand, getConfig, getDatabase, getDatabaseClasses, getDataFolder, getDefaultWorldGenerator, getDescription, getFile, getLogger, getPlugin, getPluginLoader, getProvidingPlugin, getResource, getServer, getTextResource, initialize, installDDL, isEnabled, isInitialized, isNaggable, onCommand, onDisable, onLoad, onTabComplete, reloadConfig, removeDDL, saveConfig, saveDefaultConfig, saveResource, setEnabled, setNaggable, toStringMethods inherited from class org.bukkit.plugin.PluginBase
equals, getName, hashCode
-
Field Details
-
mainConfig
protected com.stardevllc.config.file.FileConfig mainConfigDefines a FileConfig instance. This has full comment support through all versions and is similar to modern Bukkit config things
-
-
Constructor Details
-
ExtendedJavaPlugin
public ExtendedJavaPlugin()Creates a newExtendedJavaPlugin
There needs to always be a no-args constructor for Bukkit/Spigot/Paper
-
-
Method Details
-
onEnable
public void onEnable()- Specified by:
onEnablein interfaceorg.bukkit.plugin.Plugin- Overrides:
onEnablein classorg.bukkit.plugin.java.JavaPlugin
-
getMainConfig
public com.stardevllc.config.file.FileConfig getMainConfig()Gets the main config of this plugin- Returns:
- The config instance
-
saveMainConfig
public void saveMainConfig()Saves the main config -
reloadMainConfig
public void reloadMainConfig()Reloads the main config -
registerInstanceToGlobalInjector
protected void registerInstanceToGlobalInjector()Allows custom registration of this plugin's injector to the global injector in StarMCLib -
registerCommand
Registers aStarCommand. The plugin instance is provided in the constructor- Parameters:
command- The commandcmds- Any additional commands
-
registerCommand
Registers a command to the plugin
This does the same thing asregisterCommand(cmd, tabExecutor, tabExecutor- Parameters:
cmd- The command nametabExecutor- TheTabExecutorfor the command- See Also:
-
registerCommand
Registers a command to the plugin.
This does the same thing asregisterCommand(cmd, executor, null);- Parameters:
cmd- The command nameexecutor- TeCommandExecutorfor the command- See Also:
-
registerCommand
protected void registerCommand(String cmd, org.bukkit.command.CommandExecutor executor, org.bukkit.command.TabCompleter tabCompleter) Registers a command to the plugin with null safety for the command- Parameters:
cmd- The name of the commandexecutor- TheCommandExecutorfor the commandtabCompleter- TheTabCompleterfor the command. This can be null
-
registerListeners
protected void registerListeners(org.bukkit.event.Listener... listeners) Registers the listeners to the PluginManager with this plugin- Parameters:
listeners- The array of listeners
-
getEventBus
public com.stardevllc.starlib.eventbus.IEventBus<?,?> getEventBus()This is the Plugin's specificPluginEventBus- Returns:
- The event bus instance
-
createEventBus
protected com.stardevllc.starlib.eventbus.IEventBus<?,org.bukkit.event.Cancellable> createEventBus()Creates a plugin event bus for this plugin.
By default it just creates a newPluginEventBususing the constructor
Override for a custom implementation- Returns:
- The new
IEventBus
-
getColors
This is the Plugin's specificStarColorsV2
Mainly used for customization and consistency for things related to this plugin- Returns:
- The colors instance
-
createColors
Creates the colors instance for this plugin
By default it just calls the standard constructor of theStarColorsV2class- Returns:
- The new
StarColorsV2
-
getInjector
public com.stardevllc.starlib.injector.FieldInjector getInjector()This is the plugin'sFieldInjectorused in the plugin- Returns:
- The field injector instance
-
createInjector
protected com.stardevllc.starlib.injector.FieldInjector createInjector()Creates a new Field Injector instance
This creates an instace ofPluginFieldInjectorby default- Returns:
- The new
FieldInjector
-