Class PluginInfo

java.lang.Object
com.welcome234.pluginsystem.PluginInfo

public class PluginInfo extends Object
This class is used for Plugin management and registering listeners
  • Method Details

    • isEnabled

      public static boolean isEnabled(PluginJava plugin)
      Gets whether the plugin is currently enabled
      Parameters:
      plugin - Plugin instance
      Returns:
      Whether enabled, or false if not loaded
      Throws:
      IllegalArgumentException - if plugin is null
    • getName

      public static String getName(PluginJava plugin)
      Gets the name of a plugin
      Parameters:
      plugin - Plugin instance
      Returns:
      Plugin name, or null if not loaded
      Throws:
      IllegalArgumentException - if plugin is null
    • getVersion

      public static String getVersion(PluginJava plugin)
      Gets the version of a plugin
      Parameters:
      plugin - Plugin instance
      Returns:
      Plugin version, or null if not loaded
      Throws:
      IllegalArgumentException - if plugin is null
    • getPlugin

      public static PluginJava getPlugin(String name)
      Gets the plugin instance from the name
      Parameters:
      name - Name of the plugin
      Returns:
      Plugin instance, or null if not loaded
      Throws:
      IllegalArgumentException - if name is null
    • getPlugins

      public static PluginJava[] getPlugins()
      Gets all plugins currently loaded
      Returns:
      Plugin instances
    • registerListener

      public static void registerListener(EventsListener listener, PluginJava plugin)
      Registers a new event listener with an EventsListener instance
      Parameters:
      listener - EventsListener instance
      plugin - Plugin instance
      Throws:
      IllegalArgumentException - if name or plugin is null
      IllegalArgumentException - if an event listener is already registered for this plugin
      IllegalStateException - if the plugin is disabled or is not loaded
    • registerCommand

      public static void registerCommand(String command, Command commandclass, PluginJava plugin)
      Registers a new command with the Command instance
      Parameters:
      command - Command to be registered
      commandclass - Command instance
      plugin - Plugin instance
      Throws:
      IllegalArgumentException - if command, commandclass or plugin is null
      IllegalArgumentException - if the command contains spaces, or uses any command name already used
      IllegalStateException - if the plugin is disabled or is not loaded
    • registerCustomGenerator

      @Deprecated public static void registerCustomGenerator(String generatorName, CustomGenerator generator, PluginJava plugin)
      Deprecated.
      Worlds are now infinite, use registerCustomChunkGenerator instead
      Registers a new custom world generator type with the CustomGenerator instance
      Parameters:
      generatorName - Generator name to be registered
      generator - CustomGenerator instance
      plugin - Plugin instance
      Throws:
      IllegalArgumentException - if generatorName, generator or plugin is null
      IllegalArgumentException - if the generator name contains spaces, or the name is already used
      IllegalStateException - if the plugin is disabled or is not loaded
    • registerCustomChunkGenerator

      public static void registerCustomChunkGenerator(String generatorName, CustomGenerator generator, PluginJava plugin)
      Registers a new custom chunk generator type with the CustomGenerator instance
      Parameters:
      generatorName - Generator name to be registered
      generator - CustomGenerator instance
      plugin - Plugin instance
      Throws:
      IllegalArgumentException - if generatorName, generator or plugin is null
      IllegalArgumentException - if the generator name contains spaces, or the name is already used
      IllegalStateException - if the plugin is disabled or is not loaded
    • getPluginFolder

      public static File getPluginFolder(PluginJava plugin)
      Gets the directory of a plugin, for saving plugin files, configurations and resources
      Parameters:
      plugin - Plugin instance
      Returns:
      Plugin directory, or null if not loaded
      Throws:
      IllegalArgumentException - if plugin is null
    • getConfiguration

      public static Configuration getConfiguration(String name, PluginJava plugin)
      Gets a configuration for the specified name, used for saving and retrieving data

      All configuration files are stored in the plugin directory

      Parameters:
      name - Name of the configuration
      plugin - Plugin instance
      Returns:
      The configuration
      Throws:
      IllegalArgumentException - if name or plugin is null
      IllegalStateException - if the plugin is disabled or is not loaded
    • getLogger

      public static Logger getLogger(PluginJava plugin)
      Gets the logger for the specified plugin
      Parameters:
      plugin - Plugin instance
      Returns:
      Logger instance
      Throws:
      IllegalArgumentException - if plugin is null