Class ScalaPluginLoader
java.lang.Object
xyz.janboerman.scalaloader.plugin.ScalaPluginLoader
- All Implemented Interfaces:
PluginLoader,IScalaPluginLoader
-
Constructor Summary
ConstructorsConstructorDescriptionScalaPluginLoader(Server server) Per PluginLoader API, the constructor has only one parameter: the Server.ScalaPluginLoader(ScalaLoader scalaLoader) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddClassGlobally(ScalaRelease scalaCompat, String className, Class<?> clazz) Make a class visible for allScalaPlugins with a binary compatible version of Scala.voidMap<Class<? extends Event>, Set<RegisteredListener>> createRegisteredListeners(Listener listener, Plugin plugin) Internal use onlyvoiddisablePlugin(Plugin plugin) voidenablePlugin(Plugin plugin) static voidforceLoadAllClasses(ScalaPlugin scalaPlugin) Deprecated.getAllClasses(ScalaPlugin scalaPlugin) Get all classes from a scala plugin.Deprecated.useIScalaLoader.getEventBus()instead.static ScalaPluginLoaderGet the instance that was created when this ScalaPluginLoader was constructed.static JarFilegetJarFile(ScalaPlugin scalaPlugin) Get the jar file of a ScalaPlugin.getPluginDescription(File file) Pattern[]protected Class<?> getScalaPluginClass(ScalaRelease scalaCompatRelease, String className) Finds classes fromScalaPlugins.Get the ScalaPlugins.loadPlugin(File file) voidvoidopenUpToJavaPlugin(ScalaPlugin scalaPlugin, JavaPlugin javaPlugin) Deprecated.protected booleanremoveClassGlobally(ScalaRelease scalaCompat, String className, Class<?> clazz)
-
Constructor Details
-
ScalaPluginLoader
-
ScalaPluginLoader
Per PluginLoader API, the constructor has only one parameter: the Server.- Parameters:
server- the server.
-
-
Method Details
-
getInstance
Get the instance that was created when this ScalaPluginLoader was constructed.- Returns:
- the instance that was created either by bukkit's
PluginManageror byScalaLoader, or null if no ScalaPluginLoader was constructed yet. - API Note:
- if you call this method from your own plugin, your plugin must have a dependency on
ScalaLoader.
-
getEventBus
Deprecated.useIScalaLoader.getEventBus()instead.Get the event bus.- Returns:
- the event bus
- API Note:
- This method is provided for JavaPlugins. ScalaPlugin's can use
ScalaPlugin.getEventBus()instead.
-
getScalaPlugins
Get the ScalaPlugins.- Returns:
- an unmodifiable collection containing all ScalaPlugins.
-
debugSettings
Description copied from interface:IScalaPluginLoaderInternal use only- Specified by:
debugSettingsin interfaceIScalaPluginLoader
-
getPluginDescription
- Specified by:
getPluginDescriptionin interfacePluginLoader- Throws:
InvalidDescriptionException
-
getJarFile
Get the jar file of a ScalaPlugin.- Parameters:
scalaPlugin- the plugin- Returns:
- the jar file
- Throws:
IOException- if a jarfile could not be created
-
openUpToJavaPlugin
Deprecated.Makes classes from a ScalaPlugin visible to the JavaPlugin's classloader so that the ScalaPlugin can be used by the JavaPlugin.- Parameters:
scalaPlugin- the scala pluginjavaPlugin- the java plugin- API Note:
- this only makes the classes that are in the ScalaPlugin's jar file available - that excludes the Scala standard library classes.
-
getAllClasses
Get all classes from a scala plugin.- Parameters:
scalaPlugin- the scala plugin- Returns:
- an open stream that provides all classes that are in the ScalaPlugin's jar file
- Throws:
IOException- if the stream could not be opened for whatever reason
-
forceLoadAllClasses
Deprecated.UseopenUpToJavaPlugin(ScalaPlugin, JavaPlugin)instead. This method used to inject classes from the ScalaPlugin into the 'global' JavaPluginLoader scope, so that JavaPlugins could find classes from the ScalaPlugin. But since it no longer does that, it has no use to call this method anymore. This method will be removed in a future version!Loads all classes in the ScalaPlugin's jar file.- Parameters:
scalaPlugin- the ScalaPlugin
-
loadPlugin
- Specified by:
loadPluginin interfacePluginLoader- Throws:
InvalidPluginExceptionUnknownDependencyException
-
loadWhenDependenciesComeAvailable
-
getPluginsWaitingForDependencies
-
clearPluginsWaitingForDependencies
public void clearPluginsWaitingForDependencies() -
enablePlugin
- Specified by:
enablePluginin interfacePluginLoader
-
disablePlugin
- Specified by:
disablePluginin interfacePluginLoader
-
getPluginFileFilters
- Specified by:
getPluginFileFiltersin interfacePluginLoader
-
createRegisteredListeners
public Map<Class<? extends Event>,Set<RegisteredListener>> createRegisteredListeners(Listener listener, Plugin plugin) - Specified by:
createRegisteredListenersin interfacePluginLoader
-
addClassGlobally
Make a class visible for allScalaPlugins with a binary compatible version of Scala.- Parameters:
scalaCompat- the compability version of ScalaclassName- the name of the classclazz- the class- Returns:
- true if the class was added to the cache of this plugin loader, otherwise false
- Implementation Note:
- scala standard library classes are immediately rejected.
-
removeClassGlobally
-
getScalaPluginClass
protected Class<?> getScalaPluginClass(ScalaRelease scalaCompatRelease, String className) throws ClassNotFoundException Finds classes fromScalaPlugins. This method can possibly be called by multiple threads concurrently sinceScalaPluginClassLoaders are parallel capable.- Parameters:
scalaCompatRelease- the Scala version the plugin usesclassName- the name of the class- Returns:
- the class object, if a class with the given name exists, and is binary compatible with the given Scala version
- Throws:
ClassNotFoundException- if no scala plugin has a class with the given name, or the Scala version is incompatible
-
openUpToJavaPlugin(ScalaPlugin, JavaPlugin)instead.