Class CompatiblePlugin
- java.lang.Object
-
- com.github.crashdemons.playerheads.compatibility.plugins.CompatiblePlugin
-
- Direct Known Subclasses:
HeadPluginCompatibility,NoCheatPlusCompatibility,ProtectionPluginCompatibility
public abstract class CompatiblePlugin extends Object
Defines an abstract third-party-plugin compatibility class which can detect and retrieves the plugin instance.- Author:
- crashdemons (crashenator at gmail.com)
-
-
Field Summary
Fields Modifier and Type Field Description protected ConfigurationSectionconfigThe config section to be used by this compatibility class for its settingsprotected PluginparentPluginThe parent plugin requesting compatibility
-
Constructor Summary
Constructors Constructor Description CompatiblePlugin(Plugin parentPlugin, String pluginName)Construct the plugin-compatibility objectCompatiblePlugin(Plugin parentPlugin, String pluginName, ConfigurationSection config)Construct the plugin-compatibility object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Pluginget()Get the plugin instance for the third-party plugin being supported.StringgetName()Gets the proper name of the third-party plugin this class attempts to support.protected PlugingetPlugin()Get the plugin instance for the third-party plugin being supported.booleanisPresent()Whether the supported third-party plugin was detected to be present on the server.booleanisReady()Whether the plugin compatibility class is ready to be used.voidreloadConfig()
-
-
-
Field Detail
-
parentPlugin
protected Plugin parentPlugin
The parent plugin requesting compatibility
-
config
protected ConfigurationSection config
The config section to be used by this compatibility class for its settings
-
-
Constructor Detail
-
CompatiblePlugin
public CompatiblePlugin(Plugin parentPlugin, String pluginName)
Construct the plugin-compatibility object- Parameters:
parentPlugin- the current plugin requiring the compatibility (used by child classes for events and logging)pluginName- the name of the third-party plugin to support
-
CompatiblePlugin
public CompatiblePlugin(Plugin parentPlugin, String pluginName, ConfigurationSection config)
Construct the plugin-compatibility object- Parameters:
parentPlugin- the current plugin requiring the compatibility (used by child classes for events and logging)pluginName- the name of the third-party plugin to supportconfig- the configuration to use
-
-
Method Detail
-
getPlugin
protected final Plugin getPlugin()
Get the plugin instance for the third-party plugin being supported. This method has Bukkit look-up the plugin name every time it is called, unless the plugin name is blank - you should use get() instead.- Returns:
- the plugin instance, or null of the plugin name is blank
-
isReady
public boolean isReady()
Whether the plugin compatibility class is ready to be used. (By default this is true unless overridden)- Returns:
- whether the class is ready.
-
isPresent
public boolean isPresent()
Whether the supported third-party plugin was detected to be present on the server.- Returns:
- whether the plugin is present.
-
getName
public String getName()
Gets the proper name of the third-party plugin this class attempts to support.- Returns:
- the plugin name
-
reloadConfig
public void reloadConfig()
-
get
public Plugin get()
Get the plugin instance for the third-party plugin being supported. This method only looks up the plugin name with Bukkit if it was initially detected to be present.- Returns:
- the plugin instance, or null if the plugin was not present at startup.
-
-