Package org.bukkit.plugin.java
Class JavaPluginLoader
java.lang.Object
org.bukkit.plugin.java.JavaPluginLoader
- All Implemented Interfaces:
PluginLoader
Represents a Java plugin loader, allowing plugins in the form of .jar
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateRegisteredListeners(@NotNull Listener listener, @NotNull Plugin plugin)Creates and returns registered listeners for the event classes used in this listenervoiddisablePlugin(@NotNull Plugin plugin)Disables the specified pluginvoiddisablePlugin(@NotNull Plugin plugin, boolean closeClassloader)Disables the specified pluginvoidenablePlugin(@NotNull Plugin plugin)Enables the specified plugingetClassByName(String name, boolean resolve, PluginDescriptionFile description)protected Class<?>getClassByName(String name, boolean resolve, PluginDescriptionFile description, PluginClassLoader requester)getPluginDescription(@NotNull File file)Loads a PluginDescriptionFile from the specified fileReturns a list of all filename filters expected by this PluginLoaderloadPlugin(@NotNull File file)Loads the plugin contained in the specified fileprotected PluginClassLoadernewPluginLoader(JavaPluginLoader loader, ClassLoader parent, PluginDescriptionFile description, File dataFolder, File file, ClassLoader libraryLoader)
-
Constructor Details
-
JavaPluginLoader
Deprecated.This class was not meant to be constructed explicitly- Parameters:
instance- the server instance
-
-
Method Details
-
loadPlugin
@NotNull public @NotNull Plugin loadPlugin(@NotNull @NotNull File file) throws InvalidPluginExceptionDescription copied from interface:PluginLoaderLoads the plugin contained in the specified file- Specified by:
loadPluginin interfacePluginLoader- Parameters:
file- File to attempt to load- Returns:
- Plugin that was contained in the specified file, or null if unsuccessful
- Throws:
InvalidPluginException- Thrown when the specified file is not a plugin
-
newPluginLoader
protected PluginClassLoader newPluginLoader(JavaPluginLoader loader, ClassLoader parent, PluginDescriptionFile description, File dataFolder, File file, ClassLoader libraryLoader) throws Exception- Throws:
Exception
-
getPluginDescription
@NotNull public @NotNull PluginDescriptionFile getPluginDescription(@NotNull @NotNull File file) throws InvalidDescriptionExceptionDescription copied from interface:PluginLoaderLoads a PluginDescriptionFile from the specified file- Specified by:
getPluginDescriptionin interfacePluginLoader- Parameters:
file- File to attempt to load from- Returns:
- A new PluginDescriptionFile loaded from the plugin.yml in the specified file
- Throws:
InvalidDescriptionException- If the plugin description file could not be created
-
getPluginFileFilters
Description copied from interface:PluginLoaderReturns a list of all filename filters expected by this PluginLoader- Specified by:
getPluginFileFiltersin interfacePluginLoader- Returns:
- The filters
-
getClassByName
@Nullable protected @Nullable Class<?> getClassByName(String name, boolean resolve, PluginDescriptionFile description) -
getClassByName
protected Class<?> getClassByName(String name, boolean resolve, PluginDescriptionFile description, PluginClassLoader requester) -
createRegisteredListeners
@NotNull public @NotNull Map<Class<? extends Event>,Set<RegisteredListener>> createRegisteredListeners(@NotNull @NotNull Listener listener, @NotNull @NotNull Plugin plugin)Description copied from interface:PluginLoaderCreates and returns registered listeners for the event classes used in this listener- Specified by:
createRegisteredListenersin interfacePluginLoader- Parameters:
listener- The object that will handle the eventual call backplugin- The plugin to use when creating registered listeners- Returns:
- The registered listeners.
-
enablePlugin
Description copied from interface:PluginLoaderEnables the specified pluginAttempting to enable a plugin that is already enabled will have no effect
- Specified by:
enablePluginin interfacePluginLoader- Parameters:
plugin- Plugin to enable
-
disablePlugin
Description copied from interface:PluginLoaderDisables the specified pluginAttempting to disable a plugin that is not enabled will have no effect
- Specified by:
disablePluginin interfacePluginLoader- Parameters:
plugin- Plugin to disable
-
disablePlugin
Description copied from interface:PluginLoaderDisables the specified pluginAttempting to disable a plugin that is not enabled will have no effect
- Specified by:
disablePluginin interfacePluginLoader- Parameters:
plugin- Plugin to disablecloseClassloader- if the classloader for the Plugin should be closed
-