public abstract class PluginModule
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
PluginModule(java.lang.String moduleName,
java.lang.String authorName)
Constructor for a module.
|
Modifier and Type | Method and Description |
---|---|
void |
disableModule()
Disable the module.
|
java.lang.String |
getAuthor()
Get the author of the module.
|
java.lang.ClassLoader |
getClassLoader()
Get the class loader of the module.
|
java.io.File |
getDataFolder()
Get the data folder of the module.
|
ModuleLoadTime |
getLoadTime()
Get when the module should be enabled.
|
java.util.logging.Logger |
getLogger()
Get the logger of the module
ModuleLogger |
java.io.File |
getModuleFile()
Get the jar file of the module.
|
abstract org.bukkit.event.Listener[] |
getModuleListeners(SuperiorSkyblock plugin)
List of listeners to register for the module.
|
java.lang.String |
getName()
Get the name of the module.
|
java.io.InputStream |
getResource(java.lang.String resourceName)
Get the raw contents of an embedded resource within the module.
|
abstract SuperiorCommand[] |
getSuperiorAdminCommands(SuperiorSkyblock plugin)
List of admin commands to register for the module.
|
abstract SuperiorCommand[] |
getSuperiorCommands(SuperiorSkyblock plugin)
List of player commands to register for the module.
|
void |
initModule(SuperiorSkyblock plugin,
java.io.File dataFolder)
Initialize the module.
|
void |
initModuleLoader(java.io.File moduleFile,
java.lang.ClassLoader classLoader)
Initialize the module's loaders settings.
|
boolean |
isInitialized()
Check whether the module was initialized or not.
|
void |
loadData(SuperiorSkyblock plugin)
Called when the module can load data about players.
|
abstract void |
onDisable(SuperiorSkyblock plugin)
Called when the module is disabled.
|
abstract void |
onEnable(SuperiorSkyblock plugin)
Called when the module is enabled.
|
protected void |
onPluginInit(SuperiorSkyblock plugin)
Called when the module initialized for the first time.
|
abstract void |
onReload(SuperiorSkyblock plugin)
Called when the module is reloaded.
|
void |
saveResource(java.lang.String resourceName)
Saves the raw contents of an embedded resource within the module.
|
protected PluginModule(java.lang.String moduleName, java.lang.String authorName)
moduleName
- The name of the module.authorName
- The name of the author of the module.public abstract void onEnable(SuperiorSkyblock plugin)
plugin
- Instance of the plugin.public abstract void onReload(SuperiorSkyblock plugin)
plugin
- Instance of the plugin.public abstract void onDisable(SuperiorSkyblock plugin)
plugin
- Instance of the plugin.public void loadData(SuperiorSkyblock plugin)
This is similar to load data when PluginInitializedEvent
is fired.
plugin
- Instance of the plugin.protected void onPluginInit(SuperiorSkyblock plugin)
plugin
- Instance of the plugin.@Nullable public abstract org.bukkit.event.Listener[] getModuleListeners(SuperiorSkyblock plugin)
plugin
- Instance of the plugin.@Nullable public abstract SuperiorCommand[] getSuperiorCommands(SuperiorSkyblock plugin)
plugin
- Instance of the plugin.@Nullable public abstract SuperiorCommand[] getSuperiorAdminCommands(SuperiorSkyblock plugin)
plugin
- Instance of the plugin.public ModuleLoadTime getLoadTime()
ModuleLoadTime.AFTER_HANDLERS_LOADING
- modules that should be loaded before the worlds are created.
Should be used if the module needs to override the WorldsProvider.
ModuleLoadTime.NORMAL
- modules that should be loaded without any specifications.
Default for all the modules.
ModuleLoadTime.AFTER_HANDLERS_LOADING
- modules that should be loaded after all the plugin handlers.
Should be used if the module is interacting with the built-in handlers on its onEnable(com.bgsoftware.superiorskyblock.api.SuperiorSkyblock)
method.public final java.lang.String getName()
public final java.lang.String getAuthor()
public final java.io.File getDataFolder()
@Nullable public final java.io.File getModuleFile()
initModuleLoader(File, ClassLoader)
This is not an expected behavior, and the plugin will never initialize the module with a null file!@Nullable public final java.lang.ClassLoader getClassLoader()
initModuleLoader(File, ClassLoader)
This is not an expected behavior, and the plugin will never initialize the module with a null class loader!public final java.util.logging.Logger getLogger()
ModuleLogger
public final boolean isInitialized()
initModule(SuperiorSkyblock, File)
public final void saveResource(java.lang.String resourceName)
resourceName
- The name of the resource to save.public final java.io.InputStream getResource(java.lang.String resourceName)
resourceName
- The name of the resource to get contents of.public final void initModule(SuperiorSkyblock plugin, java.io.File dataFolder)
plugin
- An instance to the plugin.dataFolder
- The folder of the module.public final void initModuleLoader(java.io.File moduleFile, java.lang.ClassLoader classLoader)
moduleFile
- The file of the module jar.classLoader
- The class loader used to load the module.public final void disableModule()