Package com.welcome234.pluginsystem
Class PluginInfo
java.lang.Object
com.welcome234.pluginsystem.PluginInfo
This class is used for Plugin management and registering listeners
-
Method Summary
Modifier and TypeMethodDescriptionstatic ConfigurationgetConfiguration(String name, PluginJava plugin)Gets a configuration for the specified name, used for saving and retrieving datastatic LoggergetLogger(PluginJava plugin)Gets the logger for the specified pluginstatic StringgetName(PluginJava plugin)Gets the name of a pluginstatic PluginJavaGets the plugin instance from the namestatic FilegetPluginFolder(PluginJava plugin)Gets the directory of a plugin, for saving plugin files, configurations and resourcesstatic PluginJava[]Gets all plugins currently loadedstatic StringgetVersion(PluginJava plugin)Gets the version of a pluginstatic booleanisEnabled(PluginJava plugin)Gets whether the plugin is currently enabledstatic voidregisterCommand(String command, Command commandclass, PluginJava plugin)Registers a new command with the Command instancestatic voidregisterCustomChunkGenerator(String generatorName, CustomGenerator generator, PluginJava plugin)Registers a new custom chunk generator type with the CustomGenerator instancestatic voidregisterCustomGenerator(String generatorName, CustomGenerator generator, PluginJava plugin)Deprecated.Worlds are now infinite, use registerCustomChunkGenerator insteadstatic voidregisterListener(EventsListener listener, PluginJava plugin)Registers a new event listener with an EventsListener instance
-
Method Details
-
isEnabled
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
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
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
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
Gets all plugins currently loaded- Returns:
- Plugin instances
-
registerListener
Registers a new event listener with an EventsListener instance- Parameters:
listener- EventsListener instanceplugin- Plugin instance- Throws:
IllegalArgumentException- if name or plugin is nullIllegalArgumentException- if an event listener is already registered for this pluginIllegalStateException- if the plugin is disabled or is not loaded
-
registerCommand
Registers a new command with the Command instance- Parameters:
command- Command to be registeredcommandclass- Command instanceplugin- Plugin instance- Throws:
IllegalArgumentException- if command, commandclass or plugin is nullIllegalArgumentException- if the command contains spaces, or uses any command name already usedIllegalStateException- 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 insteadRegisters a new custom world generator type with the CustomGenerator instance- Parameters:
generatorName- Generator name to be registeredgenerator- CustomGenerator instanceplugin- Plugin instance- Throws:
IllegalArgumentException- if generatorName, generator or plugin is nullIllegalArgumentException- if the generator name contains spaces, or the name is already usedIllegalStateException- 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 registeredgenerator- CustomGenerator instanceplugin- Plugin instance- Throws:
IllegalArgumentException- if generatorName, generator or plugin is nullIllegalArgumentException- if the generator name contains spaces, or the name is already usedIllegalStateException- if the plugin is disabled or is not loaded
-
getPluginFolder
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
Gets a configuration for the specified name, used for saving and retrieving dataAll configuration files are stored in the plugin directory
- Parameters:
name- Name of the configurationplugin- Plugin instance- Returns:
- The configuration
- Throws:
IllegalArgumentException- if name or plugin is nullIllegalStateException- if the plugin is disabled or is not loaded
-
getLogger
Gets the logger for the specified plugin- Parameters:
plugin- Plugin instance- Returns:
- Logger instance
- Throws:
IllegalArgumentException- if plugin is null
-