A wrapper around writing your own implementation of
PluginLoaderto download Scala.
If you choose Scala over Kotlin or Java, the standard library is included. However, the Java standard library is part of the JRE, so Java does not incur any additional "overhead" (as in space). Unfortunately, the Scala standard library is larger than the Kotlin one. I know this because many of this organization's plugins were created using Scala. When I rewrote my plugins in Kotlin and checked the size, I noticed that it was 1–2 MB. With Scala, however, it's a lot bigger: 6 MB. That's a threefold increase in size!
The best solution I could find is that you can use Paper's loader to download the scala-library.jar (which will be reused when other plugins depend on it).
You'd have something like this in your build.sbt (to avoid including the scala-library.jar's contents in your final plugin JAR):
lazy val root = (project in file("."))
.settings(
name := projectName,
assembly / assemblyOption := (assembly / assemblyOption).value.withIncludeScala(false)
)And these few lines in your paper-plugin.yml (to depend on this plugin) to download scala-library.jar on the server instead.
dependencies:
server:
ScalaLoader:
load: BEFORE
required: true
join-classpath: trueThis plugin is licensed under the MPL-2.0 license. You can find more at https://choosealicense.com/licenses/mpl-2.0/