Package io.manebot.plugin
Interface PluginRegistration
-
public interface PluginRegistration
-
-
Method Summary
Modifier and Type Method Description Bot
getBot()
Gets the bot instance for this registration.ArtifactIdentifier
getIdentifier()
Gets the ArtifactIdentifier associated with this registration.Plugin
getInstance()
Gets the current Plugin instance for this registration.PluginManager
getPluginManager()
Gets the PluginManager instance responsible for this registration.java.util.Collection<PluginProperty>
getProperties()
Gets the plugin properties for this plugin.java.lang.String
getProperty(java.lang.String name)
Gets the value for a specific plugin property.boolean
isElevated()
Finds if the plugin is required.default boolean
isInstalled()
Finds if this registration is installed to the parent plugin manager..default boolean
isLoaded()
Finds if the plugin is loaded into the system.boolean
isRequired()
Finds if the plugin is required.Plugin
load()
Loads the plugin into the system.void
setAutoStart(boolean autoStart)
Sets if the plugin should auto-start.void
setElevated(boolean elevated)
Sets if the plugin is elevated.void
setProperty(java.lang.String name, java.lang.String value)
Sets a property on this plugin registration.void
setRequired(boolean required)
Sets if the plugin is required on start.void
setVersion(java.lang.String version)
Changes the version of this plugin.boolean
willAutoStart()
Finds if the plugin will auto-start.
-
-
-
Method Detail
-
getBot
Bot getBot()
Gets the bot instance for this registration.- Returns:
- Bot instance associated with this Plugin registration.
-
getIdentifier
ArtifactIdentifier getIdentifier()
Gets the ArtifactIdentifier associated with this registration.- Returns:
- ArtifactIdentifier instance.
-
getPluginManager
PluginManager getPluginManager()
Gets the PluginManager instance responsible for this registration.- Returns:
- PluginManager instance.
-
getInstance
Plugin getInstance()
Gets the current Plugin instance for this registration.- Returns:
- Plugin instance.
-
isInstalled
default boolean isInstalled()
Finds if this registration is installed to the parent plugin manager..- Returns:
- true if the registration is installed, false otherwise.
-
isLoaded
default boolean isLoaded()
Finds if the plugin is loaded into the system.- Returns:
- true if the plugin is loaded, false otherwise.
-
setAutoStart
void setAutoStart(boolean autoStart) throws java.lang.SecurityException
Sets if the plugin should auto-start.- Parameters:
autoStart
- true if the plugin should auto-start.- Throws:
java.lang.SecurityException
- if there was a security violation setting the property.
-
willAutoStart
boolean willAutoStart()
Finds if the plugin will auto-start.- Returns:
- true if the plugin should auto-start, false otherwise.
-
setRequired
void setRequired(boolean required) throws java.lang.SecurityException
Sets if the plugin is required on start. Required plugins failing startup on auto-start will crash the bot purposefully.- Parameters:
required
- true if the plugin is required.- Throws:
java.lang.SecurityException
- if there was a security violation setting the property.
-
isRequired
boolean isRequired()
Finds if the plugin is required. Required plugins failing startup on auto-start will crash the bot purposefully.- Returns:
- true if the plugin is required, false if it is not required during startup.
-
setElevated
void setElevated(boolean elevated) throws java.lang.SecurityException
Sets if the plugin is elevated. Elevated plugins can call routines as the system user.- Parameters:
elevated
- true if the plugin is elevated.- Throws:
java.lang.SecurityException
- if there was a security violation setting the property.
-
isElevated
boolean isElevated()
Finds if the plugin is required. Elevated plugins can call routines as the system user.- Returns:
- true if the plugin is elevated, false otherwise.
-
getProperties
java.util.Collection<PluginProperty> getProperties()
Gets the plugin properties for this plugin.- Returns:
- immutable collection of plugin properties.
-
setVersion
void setVersion(java.lang.String version)
Changes the version of this plugin.- Parameters:
version
- version to change to.
-
getProperty
java.lang.String getProperty(java.lang.String name)
Gets the value for a specific plugin property.- Parameters:
name
- name of the property to require.- Returns:
- property value, or null if it is not defined.
-
setProperty
void setProperty(java.lang.String name, java.lang.String value) throws java.lang.SecurityException
Sets a property on this plugin registration.- Parameters:
name
- key to set.value
- value to set; may be null.- Throws:
java.lang.SecurityException
- if there was a security violation setting the property.
-
load
Plugin load() throws java.lang.IllegalStateException, PluginLoadException
Loads the plugin into the system.- Returns:
- loaded Plugin instance.
- Throws:
java.lang.IllegalStateException
- if the plugin was already loaded.PluginLoadException
- if there was a problem loading the plugin.
-
-