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

    Fields
    Modifier and Type
    Field
    Description
    protected com.stardevllc.config.file.FileConfig
    Defines a FileConfig instance.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new ExtendedJavaPlugin
    There needs to always be a no-args constructor for Bukkit/Spigot/Paper
  • Method Summary

    Modifier and Type
    Method
    Description
    protected StarColorsV2
    Creates the colors instance for this plugin
    By default it just calls the standard constructor of the StarColorsV2 class
    protected com.stardevllc.starlib.eventbus.IEventBus<?,org.bukkit.event.Cancellable>
    Creates a plugin event bus for this plugin.
    By default it just creates a new PluginEventBus using the constructor
    Override for a custom implementation
    protected com.stardevllc.starlib.injector.FieldInjector
    Creates a new Field Injector instance
    This creates an instace of PluginFieldInjector by default
    This is the Plugin's specific StarColorsV2
    Mainly used for customization and consistency for things related to this plugin
    com.stardevllc.starlib.eventbus.IEventBus<?,?>
    This is the Plugin's specific PluginEventBus
    com.stardevllc.starlib.injector.FieldInjector
    This is the plugin's FieldInjector used in the plugin
    com.stardevllc.config.file.FileConfig
    Gets the main config of this plugin
    void
     
    protected void
    registerCommand(StarCommand<?> command, StarCommand<?>... cmds)
    Registers a StarCommand.
    protected void
    registerCommand(String cmd, org.bukkit.command.CommandExecutor executor)
    Registers a command to the plugin.
    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
    protected void
    registerCommand(String cmd, org.bukkit.command.TabExecutor tabExecutor)
    Registers a command to the plugin
    This does the same thing as registerCommand(cmd, tabExecutor, tabExecutor
    protected void
    Allows custom registration of this plugin's injector to the global injector in StarMCLib
    protected void
    registerListeners(org.bukkit.event.Listener... listeners)
    Registers the listeners to the PluginManager with this plugin
    void
    Reloads the main config
    void
    Saves the main config

    Methods 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, 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
  • Field Details

    • mainConfig

      protected com.stardevllc.config.file.FileConfig mainConfig
      Defines 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 new ExtendedJavaPlugin
      There needs to always be a no-args constructor for Bukkit/Spigot/Paper
  • Method Details

    • onEnable

      public void onEnable()
      Specified by:
      onEnable in interface org.bukkit.plugin.Plugin
      Overrides:
      onEnable in class org.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

      protected void registerCommand(StarCommand<?> command, StarCommand<?>... cmds)
      Registers a StarCommand. The plugin instance is provided in the constructor
      Parameters:
      command - The command
      cmds - Any additional commands
    • registerCommand

      protected void registerCommand(String cmd, org.bukkit.command.TabExecutor tabExecutor)
      Registers a command to the plugin
      This does the same thing as registerCommand(cmd, tabExecutor, tabExecutor
      Parameters:
      cmd - The command name
      tabExecutor - The TabExecutor for the command
      See Also:
    • registerCommand

      protected void registerCommand(String cmd, org.bukkit.command.CommandExecutor executor)
      Registers a command to the plugin.
      This does the same thing as registerCommand(cmd, executor, null);
      Parameters:
      cmd - The command name
      executor - Te CommandExecutor for 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 command
      executor - The CommandExecutor for the command
      tabCompleter - The TabCompleter for 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 specific PluginEventBus
      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 new PluginEventBus using the constructor
      Override for a custom implementation
      Returns:
      The new IEventBus
    • getColors

      public StarColorsV2 getColors()
      This is the Plugin's specific StarColorsV2
      Mainly used for customization and consistency for things related to this plugin
      Returns:
      The colors instance
    • createColors

      protected StarColorsV2 createColors()
      Creates the colors instance for this plugin
      By default it just calls the standard constructor of the StarColorsV2 class
      Returns:
      The new StarColorsV2
    • getInjector

      public com.stardevllc.starlib.injector.FieldInjector getInjector()
      This is the plugin's FieldInjector used 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 of PluginFieldInjector by default
      Returns:
      The new FieldInjector