Package xyz.janboerman.scalaloader
Class ScalaLoader
java.lang.Object
org.bukkit.plugin.PluginBase
org.bukkit.plugin.java.JavaPlugin
xyz.janboerman.scalaloader.ScalaLoader
- All Implemented Interfaces:
CommandExecutor
,TabCompleter
,TabExecutor
,Plugin
,IScalaLoader
The ScalaLoader plugin's main class! ScalaLoader enables you to write plugins in Scala. Just depend on ScalaLoader,
extend ScalaPlugin
, and ScalaLoader will provide the Scala runtime classes!
If you want to explicitly get the instance of the ScalaLoader plugin, use IScalaLoader.getInstance()
instead.
The implementation of ScalaLoader returned by this method depends on whether ScalaLoader is loaded as Paper Plugin or not.
- Author:
- Jannyboy11
- Note:
- undocumented methods are unintended for use outside of this plugin.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionInternal use onlyGet the EventBus used for registering and callingEvent
s.Pattern[]
Get the loaded ScalaPlugins.Get the folder from which ScalaPlugins are loaded.boolean
Get whether ScalaLoader is a Paper PluginloadOrGetScalaVersion
(PluginScalaVersion scalaVersion) Get a (fresh or cached)ScalaLibraryClassLoader
that loads standard library classes from a specific Scala version.void
void
onEnable()
void
onLoad()
Methods inherited from class org.bukkit.plugin.java.JavaPlugin
getClassLoader, getCommand, getConfig, getDataFolder, getDefaultBiomeProvider, getDefaultWorldGenerator, getDescription, getFile, getLogger, getPlugin, getPluginLoader, getProvidingPlugin, getResource, getServer, getTextResource, isEnabled, isNaggable, onCommand, onTabComplete, reloadConfig, saveConfig, saveDefaultConfig, saveResource, setEnabled, setNaggable, toString
Methods inherited from class org.bukkit.plugin.PluginBase
equals, getName, hashCode
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.bukkit.command.CommandExecutor
onCommand
Methods inherited from interface xyz.janboerman.scalaloader.compat.IScalaLoader
runInMainThread, saveScalaVersionsToConfig
Methods inherited from interface org.bukkit.plugin.Plugin
getConfig, getDataFolder, getDefaultBiomeProvider, getDefaultWorldGenerator, getDescription, getLogger, getName, getPluginLoader, getResource, getServer, isEnabled, isNaggable, reloadConfig, saveConfig, saveDefaultConfig, saveResource, setNaggable
Methods inherited from interface org.bukkit.command.TabCompleter
onTabComplete
-
Constructor Details
-
ScalaLoader
public ScalaLoader()
-
-
Method Details
-
isPaperPlugin
public boolean isPaperPlugin()Description copied from interface:IScalaLoader
Get whether ScalaLoader is a Paper Plugin- Specified by:
isPaperPlugin
in interfaceIScalaLoader
- Returns:
- true if ScalaLoader is a Paper Plugin, false if it is a regular Bukkit plugin.
- See Also:
-
getDebugSettings
Description copied from interface:IScalaLoader
Internal use only- Specified by:
getDebugSettings
in interfaceIScalaLoader
-
getScalaPluginsFolder
Description copied from interface:IScalaLoader
Get the folder from which ScalaPlugins are loaded. By default this is server_root/plugins/ScalaLoader/scalaplugins- Specified by:
getScalaPluginsFolder
in interfaceIScalaLoader
- Returns:
- the folder from which ScalaPlugins are loaded
-
getScalaPlugins
Description copied from interface:IScalaLoader
Get the loaded ScalaPlugins.- Specified by:
getScalaPlugins
in interfaceIScalaLoader
- Returns:
- the loaded ScalaPlugins.
-
getEventBus
Description copied from interface:IScalaLoader
Get the EventBus used for registering and callingEvent
s.- Specified by:
getEventBus
in interfaceIScalaLoader
- Returns:
- the event bus
-
getJavaPluginLoaderPatterns
-
onLoad
public void onLoad()- Specified by:
onLoad
in interfacePlugin
- Overrides:
onLoad
in classJavaPlugin
-
onEnable
public void onEnable()- Specified by:
onEnable
in interfacePlugin
- Overrides:
onEnable
in classJavaPlugin
-
onDisable
public void onDisable()- Specified by:
onDisable
in interfacePlugin
- Overrides:
onDisable
in classJavaPlugin
-
loadOrGetScalaVersion
public ScalaLibraryClassLoader loadOrGetScalaVersion(PluginScalaVersion scalaVersion) throws ScalaPluginLoaderException Get a (fresh or cached)ScalaLibraryClassLoader
that loads standard library classes from a specific Scala version. The classloader can either load classes from over the network directly, or use downloaded library archives (jar files).- Parameters:
scalaVersion
- the scala version- Returns:
- the class loader
- Throws:
ScalaPluginLoaderException
- if a url is malformed.
-